Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that computes the cost of a long-distance call . The cost of the call is determined according to the following rate

Write a C program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule:

  • Any call started between 8:00 a.m. (800 hours) and 6:00 p.m. (1800 hours)

during the weekdays is billed at the rate of $0.20 per minute.

  • Any call started after 6:00 p.m. (1800 hours) until 11:00 p.m. (2300 hours)

during the weekdays is billed at the rate of $ 0.15 per minute.

  • Any call made during the weekend (Saturday and Sunday) and after 11:00 p.m. and before 8:00 a.m. every day is billed at the rate of $0.10 per minute.

The input will consist of the day (d for weekday or e for weekend), the time call started, and the length of the call in minutes. The time is to be input in 24-hour notation, without the : that we often use for time. The day of the week will be read as a char. The time and the length will be integer values. You do not have to worry about a call going from one rate to another. For example if the call started at 745 and the length of the call is 30 minutes, your entire call will be calculated at the rate of the time call started.

  • Use #define to declare the rates as constants.
  • Use if / else statements in the main of your program
  • You are not required to use functions, but you can if you want.
  • Remember to initialize the sum and the most expensive call to appropriate values.

Sample output of the program

Enter the day weekday or weekend d

Enter the time the call started 900

Enter the length of the call 20

weekday 20 minute call started at 900 hrs will cost $ 4.00

a.exe

Enter the day weekday or weekend e

Enter the time the call started 100

Enter the length of the call 20

weekend 20 minute call started at 100 hrs will cost $ 2.00

a.exe

Total cost $ 6.00

Most expensive call cost $ 4.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago