Chapter 2 – Q #6: Annual Pay – Tony Gaddis – Starting Out With C++
Problem:-
annualPay: This variable will hold the employee s total annual pay, which will be calculated. |
Solution:-
#include <iostream>
using namespace std;
int main()
{
double payAmmount = 1700.0;
double payPeriods = 26.0;
double annualPay = payAmmount * payPeriods;
cout << "Total Annual Pay is " << annualPay << endl;
return 0;
}
This is the solution of this
question
Explanation of this
Solution
1.
I declare payAmmount variable and initialize given value.
2.
I declare payPeriods variable
and add
3.
Then, I declare annualPay variable and calculate the pay.
4.
In last, display output
on the screen.
5.
Return 0 to the main
function.
Also, I attach CPP file of this problem. You can
download this file
Click Here to Download This File
0 Comments