Question
translate pseudocode to java Next, you create a solution algorithm, based on the IPO chart and high level control structures you identified. PROCESS_CUSTOMER_RECORDS 1 SET
translate pseudocode to java
Next, you create a solution algorithm, based on the IPO chart and high level control structures you identified.
PROCESS_CUSTOMER_RECORDS
1 SET minKilowatt = 0.0
2 SET maxKilowatt = 1000.0
3 SET lowRateKilowattMin = 200.0
4 SET lowRate = 0.08
5 SET highRate = 0.11
6 SET totalOwed = 0.0
7 SET numCustomers = 0
8 PRINT Montly Billing Report heading
9 PRINT Customer Number | Customer Name | Kilowatts Used | Amount Owed sub-heading
10 PROMPT for customerNumber
11 READ customerNumber
DOWHILE customerNumber <> QUIT
12 PROMPT for customerName
13 READ customerName
REPEAT
14 PROMPT for kilowattsUsed
15 READ kilowattsUsed
16 IF kilowattsUsed < minKilowatt OR kilowattsUsed >= maxKilowatt THEN
PRINT ERROR! Please enter a valid number of kilowatts
ENDIF
UNTIL kilowattsUsed >= minKilowatt AND kilowattsUsed < maxKilowatt
17 IF kilowattsUsed < lowRateKilowattMin THEN
SET amountOwed = kilowattsUsed * highRate
ELSE
SET amountOwed = kilowattsUsed * lowRate
ENDIF
18 totalOwed = totalOwed + amountOwed
19 numCustomers = numCustomers + 1
20 PRINT customerNumber, customerName, kilowattsUsed, amountOwed
21 PROMPT for customerNumber
22 READ customerNumber
ENDDO
23 IF numCustomers > 0 THEN
PRINT numCustomers, totalOwed
ELSE
PRINT No customers entered
ENDIF
END
Problem: Assuming you have completed your full desk check to confirm the algorithm is correct, convert the above solution algorithm into a Java solution. Keep in mind some of the nuances in converting pseudocode to Java code, such as the use of JOptionPane, the use of try/catch for data validation, adding constants for constant values, and how REPEAT UNTIL translates into a Java loop. Your Java solution should look near identical to the solution algorithm.
Remember to use constants as appropriate, along with other good design practices you have learned in the course
Remember the use of try/catch to validate numeric input
Remember to use String.format to format a String for output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started