Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a Python program to do the following: Create a Money class that stores monetary values in dollars and cents. Your class should include: -

Develop a Python program to do the following:

Create a Money class that stores monetary values in dollars and cents. Your class should include:

- instance variables for dollars and cents

- an __init__ method

- a __repr__ printing method

- an __add__ that is passed another Money object and adds that Money data to self's Money data

- three different getter methods that return a decimal conversion of Money into that type (for example getRupees). Hint: go to a site like https://currency-converter.net/?gclid=CIeLm_7Vg9UCFQYPaQodiVIJGQ and get three different conversion rates, then use that to alter your Money object when that method is called.

- any other helper methods you may need

Save this code in Money.py.

In another file, write a program that tests your Money class. You have a lot of freedom here, just be sure you declare at least one Money object, then use all your methods, printing it, adding it to another Money object, and converting it to various currencies. Make your program user-friendly and print results in a way that make sense.

Add comments to your program starting with your name at the top, then throughout your program to describe what you are doing. Be sure and make your calculations clear, giving your variables meaningful names. Also be sure to indent consistently throughout your program to make it more readable. Be sure you run this and test it a few times before submitting.

include a menu in your main program that lets the user choose what they would like to do. For example:

Welcome to the Money Conversion program! 1: Display money 2: Add or Subtract money 3: Convert money to Rupees 4: Convert money to Yuan 5: Convert money to Euros 6: Exit Please enter your choice:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions