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), the program prints "Invalid entry".

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
Write only in java
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), the
program prints "Invalid entry".
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 S
Sample Run 2
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%=D0.0
4 single, average31800.0
4 married, average=1750.0
2 single, average%31000.0
Sample Run 3
Enter the number of employees: 0
Invalid entry
Sample Run 4
Enter the number of employees: -2
Invalid entry
Transcribed Image Text: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), the program prints "Invalid entry". 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 S Sample Run 2 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%=D0.0 4 single, average31800.0 4 married, average=1750.0 2 single, average%31000.0 Sample Run 3 Enter the number of employees: 0 Invalid entry Sample Run 4 Enter the number of employees: -2 Invalid entry
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education