answersLogoWhite

0

Start

//declare the variables

String employeeName

Real hoursWorked

Real hourlyPayRate

Real grossPay

Real netPay

Real taxRate

Integer const MAX_EMPLOYEES = 250

Integer employeeCount

Boolean continue

Character inputChar

Call displayOpeningMessage

//initialize the loop control variables

employeeCount = 0

continue = true

//process employees until user wants to stop or maximum number

//of employees have been reached

while (continue = true AND employeeCount <= MAX_EMPLOYEES )

Display "Do you want to process employee's pay?

Display "Enter 'Y' to continue, 'N' to stop"

Get inputChar

If (inputChar = 'Y' OR inputChar = 'y')

employeeCount = employeeCount + 1

Call getInput

Call calculatePay

Call displayOutput

Else

Continue = false

End if

end while

Display employeeCount, " employees have been processed"

Call displayTerminationMessage

Stop

Module displayOpeningMessage

//provide a welcome statement and directions

Display "Pay Calculator"

Display "Enter the requested values to calculate the gross pay for an employee"

End Module

Module getInput

//get the input

Display "Enter the Employee's name"

Input employeeName

Display "Enter the number of hours worked"

Input hoursWorked

Display "Enter the hourly pay rate"

Input hourlyPayRate

End Module

Module calculatePay

calculateGrossPay

calculateNetPay

end Module

Module calculateGrossPay

//calculate the gross Pay

Set grossPay = hourlyPayRate * hoursWorked

End Module

Module calculateNetPay

//find the tax rate, then calculate netPay

//note do not need to check for lower bound

//since lower bound is checked as the upper bound of the

//previous condition

If grossPay < 1500 then

taxRate = .15

else if grossPay < 3000 then

taxRate = .19

else if grossPay < 5000 then

taxRate = .21

else if grossPay < 6000 then

taxRate = .23

else

taxRate = .27

End if

netPay =grossPay * (1 - taxRate) //same as grossPay - grossPay*taxRate

End Module

Module displayOutput

//display the output

Display "The gross pay for ", employeeName, "is: "

Display "Hours worked: ", hoursWorked

Display "Hourly pay rate: ", hourlyPayRate

Display "Gross Pay: ", grossPay

Display "Tax Rate: ", taxRate

Display "Net Pay: ", netPay

End Module

Module displayTerminationMessage

//display termination message

Display "Thank you for using Pay Calculator"

Display "Enter any key to quit"

End Module

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Input a list of employee names and salaries and determine the mean average salary as well as the number of salaries above and below the mean?

Declare Names[100], Salaries[100]Set Sum = 0Set Count1 = 0Set K = 1Write "Enter Employees Name and Salary."Write "Enter *,0 when done."Input Name, SalaryWhile Salary "0"Set Count1 = Count1 + 1Set Sum = Sum + SalaryWrite "Enter another Employee Name and Salary (enter *,0 when done)"Input Name, SalaryEnd WhileSet Average = Sum / Count1Set Count2 = 0Set Count3 = 0For K = 1 Step 1 to Count1If Salary[K] > Average ThenSet Count2 = Count2 + 1End IfIf Salary[K] < Average ThenSet Count3 = Count3 + 1End IfEnd ForWrite "The Average Salary is: $", AverageWrite "The number of Salaries Above theAverage Salary is:", Count2Write "The number of Salaries Below theAverage Salary is:", Count3


How do you write a pseudocode with conditions?

Start Input x, y ; If (x


How do you write a pseudocode that accepts five numbers and displays the sum and average of the numbers?

To write pseudocode that accepts five numbers and displays their sum and average, you can follow these steps: Initialize a variable sum to 0. Loop five times to accept input for each number, adding each to sum. After the loop, calculate the average by dividing sum by 5. Display both the sum and the average. Here’s a simple representation: BEGIN sum = 0 FOR i FROM 1 TO 5 DO INPUT number sum = sum + number END FOR average = sum / 5 OUTPUT &quot;Sum: &quot;, sum OUTPUT &quot;Average: &quot;, average END


How do you write the pseudocode for an application that accepts a number as input and displays the number three times?

input number for loop = 1 to 3 inclusive print number end for


How do you write a pseudocode program that commutes and displays a 15 percent tip when you input the price of the meal?

input price calc tip = price*0.15 print tip


How do you enter a value for one edge of a cube using pseudo code?

To enter a value for one edge of a cube using pseudocode, you can follow these steps: BEGIN DECLARE edge_length AS FLOAT PRINT &quot;Enter the length of the cube's edge:&quot; INPUT edge_length END This pseudocode initializes a variable edge_length, prompts the user for input, and stores the entered value.


Explain employee mistrust as a challenge of MIS?

People are naturally afraid of MIS technology, ie ...how will it be used... against them? Consistency and reliability of input by employee, managements reaction or inaction regarding employee input.


What is the pseudocode for converting Fahrenheit to Celsius?

Oh, converting Fahrenheit to Celsius is like painting a happy little tree. Here's a simple pseudocode for you: Input the temperature in Fahrenheit Subtract 32 from the Fahrenheit temperature Multiply the result by 5/9 to get the temperature in Celsius Just remember, there are no mistakes in pseudocode, only happy little accidents.


Where is the error in the following pseudocode Display enter the length of the room input length Declare Integer length?

The order of operations. Variables must be declared before they are used.


How do you create pseudocode for number counter?

To create pseudocode for a number counter, start by initializing a variable to hold the count, typically set to zero. Use a loop to repeatedly prompt the user for input until a specific condition is met (e.g., the user enters a sentinel value like &quot;done&quot;). Inside the loop, increment the count variable for each valid input. Finally, display the total count when the loop ends.


What is the flowchart and pseudocode for a program that accept and displays the factorial of a number?

A flowchart for a program that accepts and displays the factorial of a number would include the following steps: Start, Input the number, Initialize a variable for the factorial, Use a loop to calculate the factorial by multiplying the variable by each integer up to the number, Output the result, and End. Pseudocode for the same program would look like this: START INPUT number factorial = 1 FOR i FROM 1 TO number DO factorial = factorial * i END FOR OUTPUT factorial END


Write a pseudocode statement that declares the variable total so it can hold integers Initialize the variable with the value 0?

Declare Real price=49.95 Display "the original price." Input item original price Display "price"