Please help me, its not a whole lot but its giving me a hard time. So, Here is the code that I am having problems with, I have some major logic errors in it, but I would assume that would be it.
Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
//Programmer : cerealstone
//Assignment : programming
//Purpose : To take a call start time and end time. Calculate the rate
// tax, and total for the call. Plus, to keep track of number of calls,
// and to keep track of total time.
int main()
{
int start_time, stop_time, start_mins, stop_mins, Elaps, call, length;
int Elaps1, Elaps2;
double tax, rate, cost, prime, base, total;
char answer;
call=0;
length=0;
do
{
//get start time
cout<< "Start time : ";
cin>>start_time;
if(start_time>=2100);
prime=(length/10)*.09+length%10;
//get stop time
cout<< "Stop time : ";
cin>>stop_time;
cout<<endl;
//compute start minutes
start_mins = (start_time / 100) * 60 + start_time % 100;
//compute stop minutes
stop_mins = (stop_time / 100) * 60 + stop_time % 100;
//conversion for time that is uneven
if (stop_mins < start_mins)
stop_mins=stop_mins + 1440;
//compute time elapsed
length=stop_mins- start_mins;
//Continue
cout<<"Do you wish to enter another call (y or n)? ";
cin>>answer;
cout<<endl;
//adding a call per call
call=call+1;
}
while (answer=='y');
if(answer=='n');
{
//output results
cout<<"You had "<<call<<" calls which took a total of "<<length<<" minutes calling time."<<endl;
cout<<"You will be charged: "<<endl;
//prime time calling after 9:00, 9 cents a min, tax .04
if(prime)
{
cout<< "Call cost: " << prime <<endl;
tax=prime*.04;
cout<<"Tax : "<<tax<<endl;
total=prime+tax;
cout<<"Total : "<<total<<endl;
}
//base charge is 14 cents a min, tax .04
else
{
rate=(length/10)*.14+length%10;
cout<<"Call cost: "<<rate<<endl;
tax=rate*.04;
cout<<"Tax : "<<tax<<endl;
total=rate+tax;
cout<<"Total : "<<total<<endl;
}
}
return 0;