Question

In: Computer Science

How do you validate in pseudocode a "REPEAT" "UNTIL" loop? For example if a user inputs...

How do you validate in pseudocode a "REPEAT" "UNTIL" loop? For example if a user inputs invalid data there should be an error message that reprompts for correct data.

To show this can you write Pseudo Code for the following problem?

Create an application that can determine the yearly bonus for all company employees. Not all employees are eligible for a yearly bonus. Only employees that have been with the company longer than 2 years and must have been given a rating of “Great”. Employees receiving a rating of “Bad” are not eligible for a bonus. Lastly, each department awards a different bonus amount based on percentage of yearly salary as shown below.

IT = 5% bonus

Sales=8% bonus

The application should allow the user to continually input employee data until the HR representative has reviewed all employees and has indicated they are finished entering employee data. One by one, the application will enable the HR representative to input an employee’s name, years of service, department, rating and salary. Based on data provided, the application must print well-formatted detail stating whether or not the employee is eligible for a bonus. For employees eligible for a bonus, the application must also print the amount of the bonus to be awarded to the employee. Upon completion of entering all employee data, the application will print a report that includes the total number of employees entered by the HR representative, a count of employees that are eligible for a bonus, and the average bonus amount.

Solutions

Expert Solution

START

// Intializing Variables

TotalNoOfEmployees = 0

TotalBonus = 0

CountOfBonusEmployee = 0

AverageBonus = 0

//Loop for Entering the Data of Employees by HR

REPEAT

INPUT Name

INPUT YearsOfService

INPUT Department

INPUT Rating

INPUT Salary

TotalNoOfEmployees = TotalNoOfEmployees + 1 //Total Number of Employees entered by HR

IF YearsOfService > 2 AND Rating == Great

PRINT Employee is eligible for bonus

IF Department == IT

Bonus = Salary + 0.05 * Salary

TotalBonus = Bonus + TotalBonus

CountOfBonusEmployee = CountOfBonusEmployee + 1

ELSE IF Department == Sales

Bonus = Salary + 0.08 * Salary

TotalBonus = Bonus + TotalBonus

CountOfBonusEmployee = CountOfBonusEmployee + 1

ENDIF

ELSE

PRINT Employee is not Eligible for bonus

ENDIF

UNTIL (HR representative has reviewed all the Employee and Finished entering all Employee Details)

AverageBonus = TotalBonus / CountOfBonusEmployee

PRINT TotalNoOfEmployees

PRINT CountOfBonusEmployee

PRINT AverageBonus

STOP


Related Solutions

First, write a program to loop asking for a number from the user until the user...
First, write a program to loop asking for a number from the user until the user inputs a zero or until the user has input 50 numbers. Store each value in an array except the values that are divisible by 5 and display all stored values. Determine how many of the values stored in the array were divisible by 10 and display result. Next, write a function getMinMax that accepts an array of floats and the size of the array,...
C++ please 1. Write a do while loop that continually loops until the user enters a...
C++ please 1. Write a do while loop that continually loops until the user enters a single digit between 0 and 9. There should only be one prompt for the user to enter a number inside the loop. 2. Write a simple 4 function calculator using a switch statement. The program should switch on the operator: +, -, *, /. The user should enter two numbers (any type is fine) and then enter an operator and the program should perform...
Print greeting Prompt the user for starting odometer reading Use a while loop to validate that...
Print greeting Prompt the user for starting odometer reading Use a while loop to validate that starting odometer reading is a positive number. Initialize variables: last odometer reading, current odometer reading, leg number, total fuel, moreInput While moreInput == ‘y’ Prompt the user for new odometer reading and fuel consumed If fuel is positive and new odometer reading > last odometer reading: Calculate MPG for this leg using mpg = (new odometer – last odometer) / fuel Print MPG for...
Read in user-input integers one at a time until the user types ‘q’, storing all inputs...
Read in user-input integers one at a time until the user types ‘q’, storing all inputs in a list. Then, print out the even numbers in increasing order, from smallest value to largest. Python
Ask the user how many days that they collected gems. A loop you write should loop...
Ask the user how many days that they collected gems. A loop you write should loop how many days the user enters. If the user enters 5 days, then the loop should loop 5 times to collect the data from each day. So, each loop iteration represents a day. In each loop iteration, ask the user how many gems they collected that day. After the loop finishes gathering the data for each day, calculate the total and average gems collected....
How do I add a method to make sure that the user inputs in uppercase only...
How do I add a method to make sure that the user inputs in uppercase only and anything entered in lower case throws an error as well as to make sure when they are halving the questioned number they don't enter any decimals? import java.util.*; public class TestCode { public static void main(String[] args) { String choice = "YES"; Random random = new Random(); Scanner scanner = new Scanner(System.in); ArrayList data = new ArrayList(); int count = 0,correct=0; while (!choice.equals("NO"))...
C++ How do you make a 2d array with a user input. For example, the row...
C++ How do you make a 2d array with a user input. For example, the row and columns of the 2d array will be the same so the program can create a square matrix.
Analyze and discuss examples of inputs and outputs influencing the systems model. For example, how do...
Analyze and discuss examples of inputs and outputs influencing the systems model. For example, how do interest groups and the news media provide inputs to the policy process?
What is Total repeat rate and give an example of how it would be used?
What is Total repeat rate and give an example of how it would be used?
Pseudocode please: Assignment6B: For this assignment, you should ask the user for a day and a...
Pseudocode please: Assignment6B: For this assignment, you should ask the user for a day and a month, then determine what season it is based on that input. Write a method that takes in a month and day and returns which season it is (“Spring”, “Summer”, “Fall”, “Winter”). Your main method should be the only one that includes a print statement. Note the first days of each season: • March 19th – Spring • June 20st – Summer • September 22nd...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT