The goal of this question is to design a cash register program in Java. Your register currently has the following notes/coins within it:
· One Pence: .01
· Two Pence: .02
· Five Pence: .05
· Ten Pence: .10
· Twenty Pence: .20
· Fifty Pence: .50
· One Pound: 1
· Two Pounds: 2
· Five Pounds: 5
· Ten Pounds: 10
· Twenty Pounds: 20
· Fifty Pounds: 50
The aim of the program is to calculate the change that has to be returned to the customer with the least number of coins/notes. Note that the expectation is to have an object-oriented solution – think about creating classes for better reusability.
Your program should read lines of text from standard input (this is already part of the initial template). Each line contains two numbers which are separated by a semicolon. The first is the Purchase price (PP) and the second is the cash(CH) given by the customer.
For each line of input print a single line to standard output which is the change to be returned to the customer. If CH == PP, print out Zero. If CH > PP, print the amount that needs to be returned (in terms of the currency values). Any other case where the result is an error, the output should be ERROR.
The output should the change from highest to lowest denomination.
Five Pounds, Two Pounds, One Pound, Fifty Pence, Twenty Pence, Five Pence
Twenty Pounds, Twenty Pounds, One Pound, Twenty Pence, Five Pence
Try it now!
How it works?
Follow these simple steps to get your paper done
Place your order
Fill in the order form and provide all details of your assignment.
Proceed with the payment
Choose the payment system that suits you most.
Receive the final file
Once your paper is ready, we will email it to you.
EssayBrill has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.
At EssayBrill, we prioritize on all aspects that bring about a good grade such as impeccable grammar, proper structure, zero-plagiarism and conformance to guidelines. Our experienced team of writers will help you completed your essays and other assignments.
Admission and Business Papers
Be assured that you’ll definitely get accepted to the Master’s level program at any university once you enter all the details in the order form. We won’t leave you here; we will also help you secure a good position in your aspired workplace by creating an outstanding resume or portfolio once you place an order.
Editing and Proofreading
Our skilled editing and writing team will help you restructure you paper, paraphrase, correct grammar and replace plagiarized sections on your paper just on time. The service is geared toward eliminating any mistakes and rather enhancing better quality.
We have writers in almost all fields including the most technical fields. You don’t have to worry about the complexity of your paper. Simply enter as much details as possible in the place order section.