Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would

Please write a c++ code for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes. Here is the pseudo code:

// Main module

Module main()

// Local variables

Declare Real rate, hours

// Get the rate of pay.

Call getRate(rate)

// Get the hours worked.

Call getHours(hours)

// Show the gross pay.

Call showGrossPay(rate, hours)

End Module

// The getRate module gets the pay rate.

Module getRate(Real Ref amount)

// Get the pay rate.

Display "Enter hourly pay rate."

Input amount

// Validate the pay rate.

While amount < 7.50 OR amount > 18.25

Display "Pay rate must be between 7.50 and 18.25."

Display "Enter a valid pay rate."

Input amount

End While

End Module

// The getHours module gets hours worked.

Module getHours(Real Ref hours)

// Get the hours worked.

Display "Enter hours worked:"

Input hours

// Validate the hours.

While hours < 0 OR hours > 40

Display "Hours must be between 0 and 40!"

Display "Enter a valid number."

Input hours

End While

End Module

// The showGrossPay module shows gross pay.

Module showGrossPay(Real rate, Real hours)

Declare Real gross

// Calculate the gross pay.

Set gross = rate * hours

// Display the gross pay,

Display "Employee gross pay: $", gross

End Module

This is what the output should show:

Enter the pay rate (between 7.5 AND 18.25): 7 Enter the pay rate (between 7.5 AND 18.25): 18.5 Enter the pay rate (between 7.5 AND 18.25): 18.25 Enter hours (between 0.0 AND 40.0): 41 Enter hours (between 0.0 AND 40.0): 40 Gross Pay is: $730.0

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

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions