CPSC 250-5  Final Test Gross Pay solution




5/5 - (5 votes)

Brief statement

Input hours worked and pay rate then output gross pay


This program is structured like Huron’s formula.   In that case you inputted 3 numbers, computed a number called area and outputted that number.


In this program you input the hours worked and pay rate.  Both are 64-bit floats.  The formula for gross pay is the following.


First:  gross_pay equal  hours_worked times pay_rate


If the hours_worked is greater than 40.0 then the following overtime is added to gross_pay:


overtime =  0.5 x (hours_worked – 40.0) x pay_rate


Calling diagram


Sample dialogue



CPSC 240-5 Final


Please enter hours worked:  44.0


Please enter pay rate: 10.50


The total pay is $ 483.00


The driver received 483.0000 and will keep it.







//The text in yellow is produced by compute.asm.  Everything else is from the driver.


Sample dialog with error


CPSC 240-5 Final


Please enter hours worked:  4R.00


Error try again:  25.75


Please enter pay rate: 10TF.23


Error try again: 6YY


Shut down.  You may run this program again.


The driver received 0.0 and will keep it.




//The user receives only one chance to fix an input error.


//After two consecutive failed input the program quits.


//Validation for positive inputs only is not required in this program.

Some data sets for testing your programmed



Pay rate = 5.00

Hours       3.5

Expected answer = 17.50



Pay rate:     22.70

Hours         11.2

Expected answer = 254.24



Pay rate:      15.25

Hours           52.00

Expected answer = 884.50


Pay rate:        1.00

Hours          100.0

Expected answer = 130.00


Special software engineering for this test only


You may omit 15 backup pushes and 15 backup pops


The compute module does everything important:

==> get the two inputs,

==> validate each input

==> compute the total pay,

==> output the total pay

==> return the total pay


Your name, your CWID, and “Dec 14, 2020” are the only required identifying comments.


If you borrowed files from another assignment like Huron’s program, then keep the license and the comments.




You know what to do.  Send all the files of the “Gross Pay” program

Source files

Bash file

Picture ID


to me at the usual place:


What happens next?


I have a couple more tests to administer in the middle of this week.  After that I go into electronic quarantine where I disconnect from the router.  I cannot be reached electronically until grades are submitted on January 2, 2021.   At that time I will re-connect and start to read the back log of email.  For anyone interested I will gladly send you an update of your points and explain the final curve of the semester.


Have a wonderful winter vacation.  Come back to CSUF in January all rested and ready to learn amazing things in other computer classes.  The semester was fun.  Fall 2020 is one for the memory book.  You were all great students.   I will miss all of you.  Stay in touch.