here i have written the C++ program as per the requirement.
Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): Write a program that displays a message, asks a user to enter the number of hours worked in one week, and the ba…
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
—————————————————————————————————————————————-
Note: Please note that the below program has been tested on ubuntu 16.04 system and compiled under gcc compiler. This code will also work on other IDE’s.
——————————————————————————————————————————————
Program:
——————————————————————————————————————————————
//header file declrations
#include<iostream>
#include<cctype>
#include<stdlib.h>
//Namespace declrations
using namespace std;
//start of main function
int main()
{
//variable data type declrations
int w_hours;
float b_rate, w_gross_pay;
//ask for input values
cout<<“———————————-“<<endl;
cout<<“Four Reals Incorporated”<<endl;
cout<<“Weekly Gross Pay Calculator”<<endl;
cout<<“———————————-“<<endl;
cout<<“Enter the number of hours worked: “;
cin>>w_hours;
cout<<“Enter your base hourly rate: “;
cin>>b_rate;
//if both inputs are integers
if(w_hours && b_rate)
{
//if hours are greter then 40 and less than = 60
if(w_hours > 40 && w_hours <= 60)
{
//calculate weekly pay
w_gross_pay = 40 * b_rate + (w_hours – 40) * 1.5 * b_rate;
}
//if hours are greter than 60
else if(w_hours > 60 )
{
//calculate gross pay
w_gross_pay = 40 * b_rate + (w_hours – 40 ) * 1.5 * b_rate;
}
//if hours are less than = 40
else if(w_hours <= 40)
{
//calculate gross pay
w_gross_pay = w_hours * b_rate;
}
}
//if input is not integr vale
else
{
cout<<“erroneous data was entered.”<<endl;
}
//display the weekly pay in dollers
cout<<endl<<“Your weekly gross pay is “<<w_gross_pay<<” dollars.”<<endl;
return 0;
}//end of the main function
—————————————————————————————————————————————
here i have attached a sample run of the program as a screen shot…
————————————————————————————————————————————————–
Output:

—–