Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

What are the five types of human factors?

Answered: 1 week ago

Question

What steps will Sara need to take to conduct a benefit audit?

Answered: 1 week ago

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

Question How are IRAs treated for state tax law purposes?

Answered: 1 week ago