Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB problem using Switch Case and Input commands. Write a script file that calculates the cost of a telephone call according to the following price

MATLAB problem using Switch Case and Input commands.

Write a script file that calculates the cost of a telephone call according to the following price schedule:

Duration of the call

Time of call

< =10 minutes

>10 to 30 minutes

>30 minutes

Day: 8:00AM to 6:00PM

$0.10/min.

$1.00 + $0.08/min for additional min above 10.

$2.60 + $0.06/min for additional min above 30.

Evening: 6:00PM to 12:00AM

$0.07/min.

$0.70 + $0.05/min for additional min above 10

$1.70 + $0.04/min for additional min above 30

Night: 12:00AM to 8:00 AM

$0.04/min

$0.40 + $0.03/min for additional min above 10.

$1.00 + $0.02/min for additional min above 30.

1) The program MUST use Switch Case and Input commands for full credit.

2) The program must ask the user to input if the call is Day, Evening or Night. It should contain a safeguard that tells the operator if they have not correctly identified the call as Day, Evening or Night.

3) The program must ask the operator the duration of the call.

4) The program must round up the minutes to the nearest integer.

5) Test your program to see if it runs. Be prepared to demonstrate to the instructor how the program operates if requested by the instructor.

6) Make sure to calculate the cost properly! For example a call at night lasting 12 minutes is calculated as cost=.4 + (12-10)*.03 because the $.03 rate is for the time above 10 minutes and $.40 is the base rate for that call. So the cost for the night time 12 minute call is $0.46.

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions