Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Develop Pseudo-code (English-like) Develop an algorithm to compute gross pay.

ID: 3553773 • Letter: 1

Question

1. Develop Pseudo-code (English-like)

Develop an algorithm to compute gross pay. The inputs to your algorithm are the

hours worked per week and the hourly pay rate. The rule for determining gross pay is to

pay the regular pay rate for all hours worked up to 40, time-and-a-half for all hours over 40

up to 54, and double time for all hours over 54. Compute and display the value for gross

pay using this rule. After displaying one value, ask the user whether he or she wants to do

another computation. Repeat the entire set of operations until the user says no.


2. Also, develop a Flowchart (Diagram) for the above problem.

Explanation / Answer

#include<iostream>

using namespace std;


int main()

{

int flag;

flag=1;

while(flag)

{


double pay;

double hour;

double rate;

cout<<endl<<"enter number of hours :";

cin>>hour;

cout<<endl<<"enter regular pay rate ";

cin>>rate;

if(hour<=40)

pay=rate*hour;

else if (hour>40 && hour<=54)

pay=rate*40+1.5*rate*(hour-40);

else

pay=rate*40+1.5*rate*14+2*rate*(hour-54);


cout<<endl<<"gross pay is "<<pay;


cout<<endl<<"enter 0 if you want to exit or enter 1 if you want to calculate again ";

cin>>flag;


}


}