Computers and Technology

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}}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 22:20, kandi2565
What is a programming method that provides for interactive modules to a website?
Answers: 1
image
Computers and Technology, 24.06.2019 00:10, roxymiller3942
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
image
Computers and Technology, 24.06.2019 14:30, SmartScholar4094
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
image
Computers and Technology, 25.06.2019 08:00, who0fade
Ais the hardware where the data is actually stored.
Answers: 1
Do you know the correct answer?
JavaCalculate the ChangeProgramming challenge description:The goal of this question is to design a c...

Questions in other subjects:

Konu
History, 13.10.2020 17:01