Read and FOLLOW all directions (post a screenshot of the code if possible and pr
ID: 3872926 • Letter: R
Question
Read and FOLLOW all directions
(post a screenshot of the code if possible and proof that the program can run)
c++ code language USE IF/ELSE TO SOLVE
CLEAN CODE IS A MUST! WRITE FOR READABILITY
The beginning of the program should only use:
#include
#include
using namespace std;
------------------------------------------------------------------------------------------------------------------
1a. A senior engineer is paid $1700 per week. A junior engineer is paid $900 per week.
Write a program that accepts an input the status of the engineer or a CHAR variable that can be S or J and prints out the salary of the engineer corresponding to that status. If the status is invalid, it prints an error message.
b. (in a new source code)
The salary of the employees in some company is determined as follows:
If the hours of work are less that 40 the employee recieves $8/hr otherwise, the employee recieves $320.00 plus $12.00 for each hour over 40.
Write a program that accepts the hours of the employee and prints out how much money the employee gets.
Explanation / Answer
1 (a)
Source Code
#include <iostream>
using namespace std;
int main()
{
int sa = 1700, ja = 900;
char ch;
cout<<" Enter Status of an Engineer: ";
cin>>ch;
if(ch == 's' || ch == 'S')
{
cout<<" The Salary of an Senior Engineer is $" <<sa;
}
else if(ch == 'j' || ch == 'J')
{
cout<<" The Salary of an Junior Engineer is $" <<ja;
}
else
cout<<" The Status of an Engineer is Invalid";
return 0;
}
OUTPUT
Enter Status of an Engineer: s
The Salary of an Senior Engineer is $1700
Enter Status of an Engineer: J
The Salary of an Junior Engineer is $900
Enter Status of an Engineer: a
The Status of an Engineer is Invalid
--------------------------------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
using namespace std;
int main()
{
int hr_work;
float tot_pay;
cout<<" Enter Number of Working Hours: ";
cin>>hr_work;
if(hr_work <= 40)
{
tot_pay = hr_work * 8;
}
else
{
float pay = 40 * 8;
tot_pay = ((hr_work - 40) * 320) + 120;
}
cout<<" Total Salary is to be received: $" <<tot_pay;
return 0;
}
OUTPUT
Enter Number of Working Hours: 45
Total Salary is to be received: $1720
Enter Number of Working Hours: 30
Total Salary is to be received: $240
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.