subject

JavaCalculate the ChangeProgramming challenge description:The goal of this question is to design a cash register program. Your register currently has the following notes/coins within it:One Pence: .01Two Pence: .02Five Pence: .05Ten Pence: .10Twenty Pence: .20Fifty Pence: .50One Pound: 1Two Pounds: 2Five Pounds: 5Ten Pounds: 10Twenty Pounds: 20Fifty Pounds: 50The 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. Input: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. Output: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 change from highest to lowest denomination. Test 1Test 1 Input11.2520Expected OutputFive Pounds, Two Pounds, One Pound, Fifty Pence, Twenty Pence, Five PenceTest 2Test 2 Input8.7550Expected OutputTwenty Pounds, Twenty Pounds, One Pound, Twenty Pence, Five PenceTest 3Test InputDownload Test 3 Input2010Expected OutputDownload Test 3 InputERRORCode below:please fill the functions and or classes here. thank you for help. import java. io. BufferedReader;import java. io. IOException;import java. io. InputStreamReader;import java. nio. charset. StandardCharsets;public class Main {/*** Iterate through each line of input.*/public static void main(String[] args) throws IOException {InputStreamReader reader = new InputStreamReader(System. in);BufferedReader in = new BufferedReader(reader);try {double purchasePrice = Double. parseDouble(in. readLine());double cash = Double. parseDouble(in. readLine());Main. calculateChange(purchasePrice, cash);} catch (Exception e) {System. out. println(e);}}public static void calculateChange(double purchasePrice, double cash) {// Access your code here. Feel free to create other classes as required}}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:50
Before you enter an intersection on a green light make sure
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
The more powerful, 60 volt cables and the main power shut off on an hev are both colored orange
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
question
Computers and Technology, 24.06.2019 19:20
Which command suppresses the visibility of a particular row or column in a worksheet?
Answers: 1
You know the right answer?
JavaCalculate the ChangeProgramming challenge description:The goal of this question is to design a c...
Questions
question
Mathematics, 26.06.2019 21:30
Questions on the website: 13722361