NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

///////////////////////////////////////////////////////////////////////////////
//
// Name: ComputePay.cpp
// Author: Jeffrey A. Stone & Tosin
// Course: CMPSC 121
// Purpose: Displays a table of payroll amounts for a series of
// increasing hours.
//
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// Header Files...
///////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>

///////////////////////////////////////////////////////////////////////////////
// Namespaces used....
///////////////////////////////////////////////////////////////////////////////
using namespace std;

///////////////////////////////////////////////////////////////////////////////
// Function Prototypes....
///////////////////////////////////////////////////////////////////////////////
void pause();
// pauses the program

void outputRow(int wage_hours, double amount_of_pay);
// outputs the wage hours and the amount of pay with a descriptive message.

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: main
// PARAMETERS: None
// RETURN TYPE: int
// PURPOSE: Entry point for the application.
//
///////////////////////////////////////////////////////////////////////////////

int main()
{
// set up output stream...
cout.setf(ios::fixed); // always show the decimal point
cout.precision(2); // show two digits of precision

/*
NOTE: Do not modify the main() function ABOVE this line...
*/
// declare variables to be used...
double pay = 0.0; // variable for pay
const int FORTY_HRS = 290; // comes from (40*7.25) - first 40 hrs of work
// for statement for the computation of pay
for (int i = 1; i <=75; i++) {
// conditional for between 1 and 40 hrs inclusive
if (i >= 1 && i <=40) {
// pay equation ($7.25 per hour for first 40 hrs)
pay = 7.25 * i;
}
// conditional for between 41 and 45 hrs inclusive
if (i>= 41 && i <=45) {
// pay equation ($8.00 per hour for 41-45 hrs) plus pay for 40 hrs
pay = FORTY_HRS + (i-40)*8.00;
}
// conditional for more than 45 hours
if (i>45) {
// pay equation ($10.00/hr for more than 40 hrs) plus pay for 45 hrs
pay = FORTY_HRS + (5*8.00) + (i-45)*10.00;
}
// call function to output pay
outputRow(i,pay);
}


/*
NOTE: Do not modify the main() function BELOW this line...
*/

// pause the program...
pause();

// exit the program with success (0 == success)
return 0;
}

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: pause
// PARAMETERS: None
// RETURN TYPE: void
// PURPOSE: Causes the program to wait before moving on.
//
///////////////////////////////////////////////////////////////////////////////

void pause()
{
// flush the buffer...
cin.sync();
// alert the user...
cout << "nPress any key to continue...n";
// get the next character...
cin.get();
}

///////////////////////////////////////////////////////////////////////////////
//
// FUNCTION NAME: outputRow
// PARAMETERS: int wage_hours -- the number of hours
// double amount_of_pay -- the pay for the wage_hours
// RETURN TYPE: void
// PURPOSE: Outputs the given parameters with a descriptive message.
//
///////////////////////////////////////////////////////////////////////////////

void outputRow(int wage_hours, double amount_of_pay)
{
// output a row of data....
cout << setw(3) << wage_hours << " hour(s) equals $"
<< amount_of_pay << endl;
}

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.