Hi i have completed my assignment for my foundation degree, the details of the assignment are attached describing the C++ program which to be created, which is for a telephone company to log calls and give discount depending on the time of day and day of the week, and to loop until the user has finished entering calls.
The last part asks to calculate all totals together from all calls and output them to screen,

I will be very honest and say i haven’t got a clue how to do this??
All help is very much welcome


below is my code so far,, in full working order.

//This program will output a statement
//Created by 
//Date 



#include <iostream>

using namespace std;

char day, chday, pound=156, awnser ;
int call_start, call_end, call_dur, counter, bad_time,  total_calls;
float call_cap, dis_zero, dis_six, dis_three, dis_four, fullcost, discount, end_total, next_call, call_start_hrs, call_start_min,call_end_hrs,call_end_min, tot_call_start_min, tot_call_end_min, duration;

bool dur,ans, another;



float choose_day()

{

		day=false;
cout<<"\n\n";
cout<<"=============================================================";	
cout<<"\n\n";

	cout<<		"****** Enter Day of Call ******";
	cout<<"\n\n";
	cout<<"\n\n";
	cout<<"Please enter day...Egggggggggggggggggggggggggggg";
	cout<<"\n\n";
	cout<<"M = Monday";
	cout<<"\n\n";
	cout<<"U = Tuesday";
	cout<<"\n\n";
	cout<<"W = Wensday";
	cout<<"\n\n";
	cout<<"T = Thursday";
	cout<<"\n\n";
	cout<<"F = Friday";
	cout<<"\n\n";
	cout<<"A = Saturday";
	cout<<"\n\n";
	cout<<"S = Sunday";
	cout<<"\n\n";
	cout<<"\n\n";


	


	while (!day){

//This proceedure validateds the inputed day is correct

		cin>>chday;
		cout<<"\n\n";
		

		if((chday=='M')||(chday=='U')||(chday=='W')||(chday=='T')||(chday=='F')||(chday=='A')||(chday=='S'))
			{
				day=true;
			}

		else

			{
				day=false;
				cout<<"\n\n";
				cout<<"!!Error!!...Please Enter A Valid Character";
				cout<<"\n\n";
			}

	}

	return 0;
}






float input_times()

{
	do{
cout<<"\n\n";
cout<<"=============================================================";	
cout<<"\n\n";
	
cout<<"		****** Enter Call Times ******";
cout<<"\n\n";
cout<<"\n\n";
cout<<"Please Enter Start Time Of Your Call	 ";
cin>>call_start;
cout<<"\n\n";

cout<<"\n\n";
cout<<"Please Enter End Time Of Your Call	";
cin>>call_end;

cout<<"\n\n";
cout<<"=============================================================";	
cout<<"\n\n";

if ((call_start<=0 )||( call_end>=2401)||(call_start>=call_end))
{
	dur=false;
	cout<<"Invalid Input! Please check your call times and re-enter";
}
else
{
	dur=true;
}
	}
while (!dur);
return 0;
}





float calc_min()

{
//This proceedure converts the enterd start and stop times into minuts	
	call_start_hrs=(call_start/100);
	call_start_min=(call_start%100);

	tot_call_start_min=((call_start_hrs*60)+call_start_min);

	call_end_hrs=(call_end/100);
	call_end_min=(call_end%100);

	tot_call_end_min=((call_end_hrs*60)+call_end_min);
	
	duration=((tot_call_end_min)-tot_call_start_min);

	
return 0;
}


float charge_rate()

{

	if (duration<=3)

		{
			fullcost=(1.50);
		}

			else

					{
						fullcost=((0.30)*(duration));
					}


return 0;
}




float output_day()

{

	switch(chday)
//This swich satement prints out on the screen the day the call was made on
		
{
		case 'M':
				cout<<"  *** Your Call was made on a Monday  *** ";
				cout<<"\n\n";
				break;
		case 'U':
				cout<<"  *** Your Call was made on a Tuesday  *** ";
				cout<<"\n\n";
				break;
		case 'W':
				cout<<"  *** Your Call was made on a Wensday  *** ";
				cout<<"\n\n";
				break;
		case 'T':
				cout<<"  *** Your Call was made on a Thursday  *** ";
				cout<<"\n\n";
				break;
		case 'F':
				cout<<"  *** Your Call was made on a Friday  *** ";
				cout<<"\n\n";
				break;
		case 'A':
				cout<<"  *** Your Call was made on a Saturday  *** ";
				cout<<"\n\n";
				break;
		case 'S':
				cout<<"  *** Your Call was made on a Sunday  *** ";
				cout<<"\n\n";
				break;
		default: cout<<"Error";
			
		}
return 0;
}

float output_data()
{
	
cout<<"  *** The Total number of Calls you have made today is [" <<counter++ <<"].  *** ";
	cout<<"\n\n";

cout<<"  *** Your Call Started At " <<call_start <<" Hundred hours.  *** ";
	cout<<"\n\n";

cout<<"  *** Your Call Ended At " <<call_end <<" Hundred hours.  *** ";
	cout<<"\n\n";

cout<<"  *** The Total Duration Of Your Call Is "<<duration <<" Minutes.  *** ";
	cout<<"\n\n";

cout<<"  *** The Total Cost Of Your Telephone Call Is " <<pound << fullcost<<" ***" ;

					cout<<"\n\n";	


return 0;

}




float calc_discounts()
{


			if	 (chday==('S')||(chday==('A')))
					
			{	//working
				discount=fullcost*0.06;

				cout<<"\n\n";
				cout<<"	***  The total discount is  "<<pound <<discount << " at 60% ***" ;
				cout<<"\n\n";
			}
										
					
									
					else 
						if ((call_start>=800)&& (call_end <=1700))
			
					
					{//working
						discount=fullcost*0.00;
				cout<<"\n\n";
				cout<<"	***  This call has not been discounted  ***" ;
				cout<<"\n\n";
					}
					


												else
													if ((call_start>=1700)&&(call_end<=2300))
														
												{//working
													discount=fullcost*0.03;
													cout<<"\n\n";
													cout<<"	***  The total discount is  "<<pound <<discount << " at 30% ***" ;
													cout<<"\n\n";
													}
														
					
																		else
																				
																				//working
																		{	discount=fullcost*0.04;
																			cout<<"\n\n";
																			cout<<"	***  The total discount is  "<<pound <<discount << " at 40% ***" ;
																			cout<<"\n\n";						
																		}	



			end_total=(fullcost - discount);
			cout<<"	***  The amount you pay, less discount is  " <<pound <<end_total <<" ***" ;
	cout<<"\n\n";	

			cout<<"============================================================";	
				cout<<"\n\n";
return 0;
}




float another_call()
			{
					
				do

				{
			cout<<"Do you want to make another Call?";
			cout<<"\n\n";
			cout<< "Type ( Y ) for Yes or ( N ) for No...... ";
			cin>>awnser;
			cout<<"\n\n";
			cout<<"============================================================";	
			cout<<"\n\n";

	if (awnser=='Y')
	
	{
	another=true;
	ans=true;
	}
else
	{
		cout<<"\n\n";
		cout<<"\n\n";
	cout<<" Thank you for using the Telephone Call Calculator,,,,,Goodbye";
	ans=false;		
	cout<<"\n\n";
	break;
	}

	
	}

	while(!ans);

return 0;
}


int main()


{
	counter=1;
do
{

choose_day();
input_times();
calc_min();
charge_rate();
output_day();
output_data();
calc_discounts();


another_call();
}
while(awnser=='Y');

system("pause");

return 0;
}

Please try to pose your question in a way that can be demonstrated in < 20 lines of code and is generally usable for other readers.

This article has been dead for over six months. Start a new discussion instead.