(New to programming)Homework, can somebody point me in the right direction?

I have an assignment due after these holidays. The aim of this assignment is to create a program that allows the user to enter in an Employee number, how many hours they worked each day from monday through friday, enter their deparment code and show a result of how much money they made, which deparment they're in and their employee number.

After that the user is prompted with the question of weather or not they want to enter in another employee. Iv'e done all of this using a "do while" looop and if Yes is entered it will loop right back to the start. And after that I have an 'if' statement which will terminate the program if no is entered.

Everything works fine except for the fact that when the user hits 'N' the program needs to show the total amount of money earned for each employee that was entered and I just can't find a way to make the program keep adding each lot of money earned for each employee entered. If you understand what I'm trying to do then is there anyway you could point me to the right direction for some help/ pointers/ info on what to do.

It may be messy, but it's my first real project.

Thank you very much in advanced.(Sorry for the lot of text).
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include<stdio.h>

void main()

{
//Inputs.
float EmployeeNo;//Not sure if the number will be a whole or not so I used a float.
float Hours;
float NormPay;//Normal Pay.
char DepCode;//Department Code, 'A', 'S' or 'D'
float Monday, Tuesday, Wednesday, Thursday, Friday;//Days Worked.
char YesNo;//Used in the loop.
float OverPay;//Over Pay.
float TotalPay;



 
do//The loop for the entire program.
{
	
printf("Please enter your Employee Number: ");//EmployeeNo Input.
scanf("%f%*c",&EmployeeNo);

printf("\nPlease enter the hours you work on Monday: ");//Hours Worked.
scanf("%f%*c",&Monday);
	while(Monday > 12)//If Number Greater then 12, re-ask question.

		{
			printf("\nPlease enter the hours you work on Monday: ");
			scanf("%f%*c",&Monday);
		}

printf("\nPlease enter the hours you work on Tuesday: ");//Hours Worked.
scanf("%f%*c",&Tuesday);

	while(Tuesday > 12)//If Number Greater then 12, re-ask question.
		{
			printf("\nPlease enter the hours you work on Tuesday: ");
			scanf("%f%*c",&Tuesday);
		}

printf("\nPlease enter the hours you work on Wednesday: ");//Hours Worked.
scanf("%f%*c",&Wednesday);

	while(Wednesday > 12)//If Number Greater then 12, re-ask question.
			{
				printf("\nPlease enter the hours you work on Wednesday: ");
				scanf("%f%*c",&Wednesday);
			}

printf("\nPlease enter the hours you work on Thursday: ");//Hours Worked.
scanf("%f%*c",&Thursday);

	while(Thursday > 12)//If Number Greater then 12, re-ask question.
		{
			printf("\nPlease enter the hours you work on Thursday: ");
			scanf("%f%*c",&Thursday);
		}

printf("\nPlease enter the hours you work on Friday: ");//Hours Worked.
scanf("%f%*c",&Friday);

	while(Friday > 12)//If Number Greater then 12, re-ask question.
		{
			printf("\nPlease enter the hours you work on Friday: ");
			scanf("%f%*c",&Friday);
		}
	
	//Hours worked in total.
	Hours = Monday + Tuesday + Wednesday + Thursday + Friday;
	
//Department Code Input.
printf("\nPlease enter your Deparment code, ethier 'A', 'D' or 'S': ");
scanf("%c%*c",&DepCode);

	
	NormPay = Hours * 7.50;//Pay calculations.
	
	if(Hours <=40)
	{
		OverPay = 0;
	}
	else
	{
		if(Hours <= 50)
		{
			OverPay = (Hours - 40) * 1.5;
		}
		else 
		{
			if(Hours > 50)
			{
				OverPay = (Hours - 50) * 2;
			}
		}
	}

		switch(DepCode)//Switch Case for Department Code Entries.
			{
			case 'A':
			case 'a':
				
				printf("\nYour Employee Number is $%.0f.\nYour Normal Pay is $%.0f.\nYour Overtime pay is $%.0f.\nAnd your Deparment is Administration.\n\nPlease Press 'Enter' to continue.",
				EmployeeNo, NormPay, OverPay);
				scanf("%*c");

				break;

			case 'S':
			case 's':
				
				printf("\nYour Employee Number is $%.0f.\nYour Normal Pay is $%.0f.\nYour Overtime pay is $%.0f.\nAnd your Deparment is Supply.\n\nPlease Press 'Enter' to continue.",
				EmployeeNo, NormPay, OverPay);
				scanf("%*c");

				break;

			case 'D':
			case 'd':

				printf("\nYour Employee Number is $%.0f.\nYour Normal Pay is $%.0f.\nYour Overtime pay is $%.0f.\nAnd your Deparment is Development.\n\nPlease Press 'Enter' to continue.",
				EmployeeNo, NormPay, OverPay);
				scanf("%*c");

				break;


			default:
				//If Deparment Code entry is false.
				printf("\n");
				printf("\n!!!!!INVALID ENTRY!!!!!.\n");
				
			}
	

	printf("\nDo you want to enter in another employee? Y/N: ");//Re-Entry to program.
	
	scanf("%c%*c",&YesNo);
	printf("\n");
	
	

}while(YesNo == 'Y' || YesNo == 'y');//The end of the loop.




if(YesNo == 'N' || YesNo == 'n')//To end program.
{
	
	
		//Do Not! know how to calculate all entries and show a total yet.
		printf("\nThis is the Total Normal Pay of all employee's $%.0f.",TotalPay);
		scanf("%*c");
	
}

scanf("%*c");

}
Maybe you could create a variable that will hold a running sum of NormalPay+OverPay at the end of every iteration of your do-while loop.

something along the lines of:

double TotalPay += (NormalPay+OverPay);

Just a suggestion, tho.
Hey oghmaosiris, thank you so very much. I used the 'TotalPay += NormalPay;' and it worked like a charm! Thank you again for the info.
Topic archived. No new replies allowed.