Write a cashregister class that can be used

Assignment Help JAVA Programming
Reference no: EM131601320

Write a CashRegister class that can be used with a RetailItem class. 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 reuturn 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.
---------------------------------------------------------
The output should look like this:
Item being purchased: Apple
Units on hand: 75
Price: $0.25
How many apples are you buying? 100
Sorry, we only have 75 in stock.
---------------------------------------------------
Item being purchased: Apple
Units on hand: 75
Price: $0.25
How many apples are you buying? 15
Subtotal: $3.75
Sales Tax: $0.23
Total: $3.98
Units on hand: 60

Reference no: EM131601320

Questions Cloud

Explain the concept of moore law : Please explain the concept of Moore's Law and how it relates to ever more capable mobile devices in today's world.
Explain the information systems infrastructure : Select a topic from the following list on which you would like to conduct an in-depth investigation: Strategic importance of cloud computing in business.
Traditional crime policy with evidence-based crime policy : Compare and contrast traditional crime policy with evidence-based crime policy
Discuss how you will apply the strategic management process : Discuss how you will apply the strategic management process in your Strategic Plan? Address the three stages of the strategic management process.
Write a cashregister class that can be used : Write a CashRegister class that can be used with a RetailItem class. The CashRegister class should simulate the sale of a retail item
Field of information technology continue : Industry Certifications in the field of Information Technology continue to play a role in the employment process as well as deciding how to measure.
What is your process for assessing the risks : How will you manage the group? What is your process for assessing the risks? What techniques will you use? Where will you start?
Hospital the landlords had already covered up the area : Anyone on here familiar with civil, law when it comes to falling through a porch of a home you are renting
What is the value storedin the variable mystery : What is the value storedin the variable mystery after each line in the following code segment - mystery now has the value

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd