Hi guys im stuck with my homework again and looking for any help. Ill post up the instructions..I did step 1 except the bold part..
1 Defining variables and prompting the user for input. To store the raise percentage and years of employment that the user inputs, define int variables rate and years, in main after line 12. Also define double variable wage to store the user’s annual wage. Then, insert statements that prompt the user for the raise percentage, years of employment and starting weekly wage. Store the values typed at the keyboard in the rate, years and wage variables, respectively.
To find the annual wage, multiply the new wage by 52 (the number of weeks per year) and store the result in wage.
2. Displaying a table header and formatting output. Use the left and setw stream manipulators to display a table header as shown in Fig. 8.22 in your text. The first column should be six characters wide. Then use the fixed and setprecision stream manipulators to format floating- point values with two positions to the left of the decimal point.
3. Writing a for statement header. Insert a for statement. Before the first semicolon in the for statement header, define and initialize the variable counter to 1. Before the second semicolon, enter a loop- continuation condition that will cause the for statement to loop until counter has reached the number of years entered. After the second semicolon, enter the increment of counter so that the for statement executes once for each number of years.
4. Calculating the pay raise. In the body of the for statement, display the value of counter in the first column and the value of wage in the second column. Then calculate the new weekly wage for the following year, and store the resulting value in the wage variable. To do this, add 1 to the percentage increase (be sure to divide the percentage by 100.0 ) and multiply the result by the current value in wage.
It is supposed to look like this
http://img.photobucket.com/albums/v323/Monkeyman1010/worrkkskssss.gif
This is my code so far...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int rate,
years;
double wage;
cout << "Please enter your raise percentage:";
cin >> rate;
cout << "Please enter your years of employment:";
cin >> years;
cout << "Please enter your weekly wage:";
cin >> wage;
cout << "\n";
return 0;
}
| |
I know I have to use a for statement, but im kinda confused how to in this application....If anyone can help me with the next step I think I will be able to finish it.