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

  Create a program that does runtime performance

Create a program that does runtime performance analysis of ArrayLists, TreeSets and HashSets.Add 100,000 random random integers ( 0 - 1,000,000 )Attempt to remove 10,000 random integers ( 0 - 1,000,000 )

  Create a table that depicts the runtime for arrays

Create a table that depicts the runtime for arrays of length 1 to 10. Would you expect the general runtime to be O(n), O(n2), O(n3), or some other function of n? Explain

  Write a bash script larger x y that compares the sizes

Write a bash script larger X Y that compares the sizes of two specified files X and Y, and reports which file is larger. For example, if X is larger, the output should be "File X is larger", while if Y is larger, the output should be "File Y is la..

  Write java statements to create a collection of integers

Write Java statements to create a collection of integers, and to initialize each element of the collection to -1. Then, using for each statement to print the value of each element.

  Website that utilizes drag-and-drop or web sockets

A website that utilizes drag-and-drop or web sockets. Review the website source, and evaluate how the author created the pages

  Create wheel 360 degree

You have to create wheel, 360 degree. That is numbered 0-36. it is supposed to be spun, and randomly lands on one of the numbers.

  Description of routes and services

Write a method for finding a journey from one station to another using an algorithm that is specified below in this handout.

  Part - 1build a graphical user interface for displaying the

part - 1build a graphical user interface for displaying the image groups cluster in jmjrst. design and implement using

  Provides a method named ispalindrome

Write a complete Java program that provides a method named isPalindrome, which takes aQueue of integers as a parameter and returns true if the numbers in the Queue represent a palindrome (and false otherwise). The empty Queue should be considered ..

  State a java class named accumulator the class comprises

question define a java class named accumulator. the class contains the following elementsa. an integer variable named

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Prepare a program that constructs a binary tree and

prepare a program that constructs a binary tree and traverses the tree in pre-order in-order and post-order methods.

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