Question: You will create a class that keeps track of the total retail cost total taxes, total retail cost with taxes and number of items in

 You will create a class that keeps track of the total

You will create a class that keeps track of the total retail cost total taxes, total retail cost with taxes and number of items in a shopping bag. - Create a class called ShoppingBag. Objects of this chass represent a single shopping bag. Attributes of such an object include the number of items in the bsg and the total retail cost of those items. - Provide a constructor that accepts a tax rate as a double argument. - Provide a transformer method called place that models phacing a number of identically priced items into the bag-it accepts an int argument indicating the number of items and a double argument that indicates the cost of each of the items. For example, myBag- place(5, 10.5) represents placing five items that cost $1050 each into mybag. - Provide getter methods for both the number of items in the bag and their total retail cost. - Provide a totalCost method that returns the total cost with tax included. - Provide a tostring method that retums a nicely formatted string that summarizes the current status of the shopping bag. - Provide a program, a "test driver't that demonstrates that your ShoppingBag class performs correctly. - Create an application that repestedly prompts the user for a number of items to put in the bage followed by a prompt for the cost of those items. - Use a 0 for the number of items to indicate that there are na more items. - The program then displays a summary of the status of the shopping bage- - Assume the tax rate is 6%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!