Solved

# Write a program that computes the cost of a long-distance call. The cost of the call is determined according <br>to the following

Posted on 2001-07-07
2,404 Views
A. any call started between 8 am and 6 pm, Mon-Fri, is billed at a rate of .40 per minute
B. any call starting before 8 am or after 6 pm M-F should be billed at .25 per minute
C. any call started on Sat ot Sun is charged at a rate of .15 per minute
The input will consist of the day of the week, the time the call started, and the length of the call in minutes. The output will be the cost of the call. The time is to be input in 24hr notation and the day of the week as Mo/ Tu/ We/Th/Fr/sa/Su
The number of minutes will be input as a value of "int". There should be a loop that lets the user repeat the calculation until they are done. When this program is finished and debugged, write a variant that will read the information for all of the phone calls in one week from a file and then writes a phone bill to another file. The phone bill would show each call, and the charge for each call plus the total for all calls. List the phone calls in the same order as the appear in the input file.

I think I have the logic correct, the input will be day of the week, time the call starts, and length of call (int) and the output will be the cost. I have to make a loop to be able to do multiple computations, before I tell it to quit. If the logic is right then I need with the syntax.

#include<iostream.h>
day(Mo,Tu,We,Th,Fr,Sa,Su);
double length_of_call;
rate_1(day,length_of_call,.40)
rate_2(day,length_of_call,.25)
rate_3(day,length_of_call,.15)
{
int choice=1;
while(choice==1;     //initializing the start of the while loop

cout<<" please enter the day of the week the call was made"<<endl;

cin>>(Mo,Tu,We,Th,Fr,Sa,Su);
cout<<"please enter the hour the call started in military time"<<endl;
cin>>hour;
cout<<"please enter the minute the cal started"<<endl;
cin>>minute;
cout<<"please enter the length of the call in minutes"<<endl;
cin>>minutes;

}
double rate_1(day*length_of_call*rate);
}
double rate_2(day*length_of_call*rate);
}
double rate_3(day*length_of_call*rate);
}
if day==(Mo,Tu,We,Th,Fr)
{
&& 0800<timestart<1800;
}
cost_of_call==(minutes*.40)
{
if day==(Mo,Tu,We,Th,Fr)
&& 1800<timestart<0800;
}
cost_of_call==(minutes*.25)
{
if day==(Sa,Su)
}
cost_of_call==(minutes*.15)
cout<<"Do you want to enter another number and run this program again"<<endl;
cout<<"1.Yes"<<endl;
cout<<"2.No"<<endl;
cin>>choice;
while((choice!=1)&&(choice!=2))
{
cin>>choice;
if(choice==2)
cout<<"\n Please hit any key to end the program"<<endl;

}
return 0;
}

0
Question by:Diverden

LVL 22

Accepted Solution

nietod earned 200 total points
ID: 6261778
We cannot do your schoolwork for you.  That is unethical and is grounds for removal from this site.  (for both you and the experts involved.)

We can provide only limitied help in accademic assignments.    We can answer specific (direct) questions, like you might ask your teacher.  We can review your work and post suggestions, again, like your teacher might do.

Do you have specific questions?
Do you have any work on this (incomplete even) that we can review?
0

LVL 11

Expert Comment

ID: 6825606
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to refund the points and delete this question since nobody had an answer for you.

The link to the Community Support area is: http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

======
Werner
0

LVL 5

Expert Comment

ID: 6875070
Force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

LVL 33

Expert Comment

ID: 6879548
Netminder, I think you should delete this question instead of force accepting an answer which is obviously not an answer.

hongjun
0

LVL 11

Expert Comment

ID: 6879767
Yep, I think our friend was in the 'accept nietod' mode from the question before that ... ;-)

======
Werner
0

LVL 5

Expert Comment

ID: 6880055
*smile*... Actually, I was in my "Accept anyone who spanks a student for asking us to do his homework" mode. There's a big part of me that appreciates nietod's untiring efforts to get people to understand that our doing someone else's work is tantamount to cheating on a test; there's a huge difference between that and assisting someone with a problem.

The argument that nietod didn't answer the question is, of course, a good one, and therefore, the argument that he's undeservedly received points and an A for doing nothing the logical conclusion. I disagree, because I think the only people who might "buy" this question from the PAQ are other students who would be trying to skate around learning something by cheating the system -- essentially, getting something for nothing. If a student trying to find a solution unethically pays something for nothing, then he/she deserves it for trying to cheat.

In the long run, a cheater will cheat; having read hundreds of attempts to get one's homework done at this site, I'm always amazed at the number of Experts willing to get points for doing the wrong thing (or helping someone else do the wrong thing), even when they're TOLD that doing a student's homework for him/her is a violation of the membership agreement. It's high time, in my estimation, that someone was rewarded for doing the RIGHT thing.

Netminder
0

LVL 11

Expert Comment

ID: 6880134
Netminder

I have no problem at all that nietod gets these points. As you stated already, he is one of those who always tell students that we are not doing their homework. I feel that these askers shouldn't get their points refunded if they are not coming back with real questions. (And that's what I am suggesting in my C++ cleanup already).

I just feel uncomfortable that people might search for a solution for one of these problems, pay the price to get in and get .... nothing ....

Let's delete this Q, please and nietod will keep his deserved points.

======
Werner
0

LVL 5

Expert Comment

ID: 6880173
Werner,

*grin*... that's my point. If someone buys this question, the odds are that he/she is another student taking the same course and is stumped by (or too lazy to figure out) the same question.

To me, it's like getting caught with a purchased term paper -- you shouldn't be surprised, and you have no complaint, if you fail a class you cheated to try and pass.

I'll leave it open until I hear from nietod, or until late this afternoon... then I'll delete it... *sigh*

Netminder
0

LVL 11

Expert Comment

ID: 6880228
Sorry, I got you ... looking at the question again, it's too obvious, you are right ...

OK, I agree, let's have some fun :-) But it would be nice to KNOW if someone bought it ...

======
Werner
0

LVL 5

Expert Comment

ID: 6880264
<laughing>

If someone does, I'm certain that one of two things will happen: Either we'll see a CS question asking for a refund, or we'll never hear about it because someone has actually been caught trying to cheat.

N
0

## Featured Post

Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and â€¦
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a Gâ€¦
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.