Question: Write a program that asks the user to enter the number of employee's and depending on this number he will be asked to enter

Write a program that asks the user to enter the number of employee's and depending on this number he will be asked to enter information of each employee (check sample runs). For each employee the program must ask the user to enter the employee salary and marital status. The marital status is 'M' for married and 'S' for single. After all information are entered, the program should display the following: The number of married employee's and the average of their salaries The number of single employee's and the average of their salaries Note that: the number of employees should be positive, if the user enters an invalid value (zero or negative), he will be asked repeatedly to enter a positive number until he enters a valid one. Sample Run 1 Enter the number of employees: 6 Enter salary and status for employee 1: 1000 M Enter salary and status for employee 2: 1500 M Enter salary and status for employee 3: 1200 S Enter salary and status for employee 4: 1500 M Enter salary and status for employee 5: 3000 M Enter salary and status for employee 6: 800 5 4 married, average=1750 2 single, average=1000 Sample Run 2 Enter the number of employees: 0 Enter the number of employees: -5 Enter the number of employees: 4 Enter salary and status for employee 1: 1700 S Enter salary and status for employee 2: 2400 S Enter salary and status for employee 3: 1900 S Enter salary and status for employee 4: 1200 S ===== O married, average=0 4 single, average=1800
Step by Step Solution
3.33 Rating (156 Votes )
There are 3 Steps involved in it
Answer Total answers posted by the expert is 1948 import ... View full answer
Get step-by-step solutions from verified subject matter experts
