The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
The question and project is in the attached file to make it easier to read but I will also post it right below also.
Â
Â
Step 1. (Design) Draw a UML class diagram for an ItemToPurchase class with the following specifications:
Â
Each setXXX() should have return type void and take a parameter matching the type of the data member it sets. Each getXXX() should return the corresponding data member.
Â
Step 2. Build the ItemToPurchase class.Â
Â
Step 3. Provide a driver class ShoppingCartPrinter. In its main(),
Â
Step 1. (Design) Draw a UML class diagram for an ItemToPurchase class with the following speciFca±ons:private data members (Felds)oString itemName - Ini±alized in default constructor to "none"odouble itemPrice - Ini±alized in default constructor to 0.0oint itemQuan±ty - Ini±alized in default constructor to 0Default constructor (zero parameter)A three-parameter constructor with parameters for item name, price, and quan±typublic member methods (mutators & accessors)osetName() & getName()osetPrice() & getPrice()osetQuan±ty() & getQuan±ty()odouble getSubtotal(): returns itemPrice * itemQuan±tyovoid display():display item informa±on. See sample run for format. Price and subtotalshould be displayed with 2 digits a²er the decimal point.Each setXXX() should have return type void and take a parameter matching the type of the data memberit sets.Each getXXX() should return the corresponding data member.Step 2. Build the ItemToPurchase class.Step 3. Provide a driver class ShoppingCartPrinter.In its main(),Prompt user for item 1, create an object of the ItemToPurchase class by invoking the defaultconstructor, and then call setXXX() to set the values of its data members.Prompt user for item 2, and create an object of the ItemToPurchase class by invoking the three-parameter constructorCall display() of each item to print item informa±on.Call appropriate methods of the two objects to retrieve subtotal, add together, and output
Attachments: