Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ language fill in the blanks Part a #include #include using namespace std; /******************************************************************************* * Function prototype *******************************************************************************/ void computePaycheck( double , unsigned , double

C++ language fill in the blanks

Part a

#include

#include

using namespace std;

/*******************************************************************************

* Function prototype

*******************************************************************************/

void computePaycheck(double, unsigned, double&, double&, double = 0.15);

/*******************************************************************************

* Description:

* Starting point of the program. Asks the user to enter their pay rate

* and hours worked to calculate and display their paycheck.

*

* Input(s):

* N/A

*

* Output:

* An integer that signals the exit code to the operating system (OS)

*******************************************************************************/

int main() {

// variables

double payRate = 0.0, grossPay = 0.0, netPay = 0.0;

unsigned hours = 0;

// adjust the output to include two digits after the decimal point

cout << fixed << setprecision(2);

// TODO: prompt and store the pay rate

// TODO: prompt and store the hours worked

// TODO: call the function to compute the paycheck

// TODO: display the gross pay and net pay

// terminate

return 0;

}

Part b

#include

using namespace std;

/*******************************************************************************

* Function prototypes

*******************************************************************************/

void readTemps(float[], const int);

float calcAverage(const float[], const int);

float calcHigh(const float[], const int);

float calcLow(const float[], const int);

/*******************************************************************************

* Description:

* Starting point of the program. Asks the user to select the number of

* temperature recordings to save (cannot exceed `MAX_SIZE`). Calls the

* auxiliary functions and displays the results.

*

* Input(s):

* N/A

*

* Output:

* An integer that signals the exit code to the operating system (OS)

*******************************************************************************/

int main() {

// variables

const int MAX_SIZE = 50;

int actualSize = 0;

float tempArray[MAX_SIZE];

// validation loop

do {

cout << "Please input the number of temperatures to be read: ";

cin >> actualSize;

} while ((actualSize == 0) || (actualSize > MAX_SIZE));

// call the functions

readTemps(tempArray, actualSize);

cout << "The average temperature is " << calcAverage(tempArray, actualSize);

cout << " The highest temperature is " << calcHigh(tempArray, actualSize);

cout << " The lowest temperature is " << calcLow(tempArray, actualSize);

// terminate

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Revenue at 3 0 0 units ? refer image

Answered: 1 week ago