subject

Write a CashRegister class that can be used with the RetailItem class that you wrote in Chapter 6’s Programming Challenge 4. The CashRegister class should simulate the sale of a retail item. It should have a constructor that accepts a RetailItem object as an argument. The constructor should also accept an integer that represents the quantity of items being purchased. In addition, the class should have the following methods: • The getSubtotal method should return the subtotal of the sale, which is the quantity multiplied by the price. This method must get the price from the RetailItem object that was passed as an argument to the constructor. • The getTax method should return the amount of sales tax on the purchase. The sales tax rate is 6 percent of a retail sale. • The getTotal method should return the total of the sale, which is the subtotal plus the sales tax. Demonstrate the class in a program that asks the user for the quantity of items being purchased, and then displays the sale’s subtotal, amount of sales tax, and total.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
In which phase does software coding and testing happen in the spiral model? the spiral model does not have a separate testing phase. both, software coding and testing occurs during the phase.
Answers: 3
question
Computers and Technology, 23.06.2019 06:40
How many nibbles can be stored in a 16-bit word?
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
You know the right answer?
Write a CashRegister class that can be used with the RetailItem class that you wrote in Chapter 6’s...
Questions
question
Chemistry, 01.09.2020 19:01
question
Advanced Placement (AP), 01.09.2020 19:01
question
Mathematics, 01.09.2020 19:01
question
Mathematics, 01.09.2020 19:01
question
Advanced Placement (AP), 01.09.2020 19:01
Questions on the website: 13722360