Question
A software company offers three types of services: development, training, and consulting. The hourly rates are shown below. Service Type Service Hourly Rate 1 Development
A software company offers three types of services: development, training, and consulting. The hourly rates are shown below.
Service Type
Service
Hourly Rate
1
Development
$70
2
Training
$50
3
Consulting
$60
Write java program that asks the user to enter the service and the hours spent, then calculates and outputs the service charge.
You should use a flag-controlled or a sentinel-controlled while loop so that the program can get a series of sales data until the user enters 0. Inside the loop, a switch structure is used to help select a product and output the cost for each product.
Your program should also calculate and output the total service charges of each service, and the overall service charges of all services.
Sample run:
Software Company Program
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 1
Enter the hours spent: 20.5
Service charge: $1,435.00
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 6
Invalid service type number (enter 1, 2, or 3), try again.
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 2
Enter the hours spent: -23
The hours spent must be greater than zero, try again.
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 2
Enter the hours spent: 23
Service charge: $1,150.00
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 3
Enter the hours spent: 15.75
Service charge: $945.00
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 2
Enter the hours spent: 8
Service charge: $400.00
******************************************************
Enter the service type number 1, 2, or 3 or 0 to exit.
1 --- Development
2 --- Training
3 --- Consulting
0 --- Exit
Select a number: 0
Total service charge for each service type:
Development: $1,435.00
Training: $1,550.00
Consulting: $945.00
Total service charge of all service types: $3,930.00
Thank you for using this program!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started