Write a program that computes the cost of long distance call

Assignment Help C/C++ Programming
Reference no: EM1366153

Conditional Statements

Question 1: Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules.

  • A call made between 8:00 AM and 6:00 PM is billed at a rate of 6 rupees per minute.
  • A call made before 8:00 AM or after 6:00 PM is charged at a rate of 3.75 rupees.

According to this schedule, if a call starts at any time between 8:00 AM and 6:00 PM, and it ends after 6:00 PM then it will be charged at the rate of 6 rupees per minute for the time before 6:00 PM and for the rest of the time the rate will be 3.75 rupees per minute. For example if a call starts at 5:55 PM and ends at 6:05 PM then the charges on this call will be 48.75 (30 rupees for first 5 minutes and 18.75 rupees for rest of the time).

 

Similarly if a call starts at the time before 8:00 AM but ends after 8:00 AM then it will be charged at the rate of 3.75 rupees for the time before 8:00 AM and for remaining minutes after 8:00 AM the rate will be 6 rupees per minute. For example if a call starts at 7:49 AM and ends at 8:01 AM the charge on that call will be 47.25 rupees (41.25 for first 11 minutes and 6 rupees for last minute).

The input to the program will consist of the time the call started, and the length of call in minutes. The output will be the cost of call. The time is to be input in 24-hours notation, so the time 1:30 PM is input as 13:30. The time will be input using two variables of type int, one used for hour and other used for minutes. The number of the minutes for length of the call will also be input as a value of type int.      

After completing the program test it for following inputs.

Input

Output

Start time

Length

Cost

8: 21

10

60

17:55

10

 

7:49

12

 

6:00

30

 

8:00

5

 

Question 2: You are required to modify the program written for calculating call charges according to the following schedule.

  • Any call made between 8:00 AM and 6:00 PM, Monday through Friday, is billed at a rate of 6 rupees per minute.
  • Any call made before 8:00 AM or after 6:00 PM, Monday through Friday, is charged at a rate of 3.75 rupees per minute.
  • Any call made on a Saturday or Sunday is charged at a rate of 1.5 rupees per minute.

The modified program will also input the day of the week along with the other inputs. The day of the week will be read as one of the following pairs of character values, which are stored in two variables of type char:

Su                  Tu Th Sa                           We Fr Su

 

The rules for calculating the charges for a call are same as in the previous program with following enhancements.

If a call is started on Friday at 11:55 PM and ends at 12:05 AM on Saturday then the rate of the call will be calculated as cost of call as per schedule on Friday for first 5 minutes, plus the cost of call as per schedule on Saturday for rest of the 5 minutes. Similarly, if a call starts on Sunday at 11:55 PM and ends at 12:05 AM on next day i.e. Monday, then the cost of the call will be calculated as charges as per schedule on Sunday plus the charges as per schedule on Monday.

After completing the program test it for following inputs.

Input

Output

Start time

Length

Day

Cost

8: 21

10

Monday

60

17:55

10

Tuesday

 

7:49

12

Friday

 

6:00

30

Sunday

 

23:55

10

Friday

 

23:51

20

Sunday

 

 

 

 

 

 

Reference no: EM1366153

Questions Cloud

What percentage interest in the pool : What percentage interest in the pool is held by the town and the school district? Show the entry in the Investment Trust Fund to record the School District's investment in the pool.
Business operations management layout design : Business Operations Management Layout Design for custom bicycle assembler - Identify the type of layout that might be adopted by a high end custom bicycle assembler
Show drivers of negotiation : What is the significance of goal setting before a meeting. what could happen if this preparation is not done and what is the difference between a tactic and a strategy. Are both needed, if so, when.
Show integrative negotiations : What steps would you take following an integrative negotiations strategy and which steps pose the greatest challenges and why.
Write a program that computes the cost of long distance call : Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules.
Create a 30-second elevator speech : Create a 30-second elevator speech (pitch) where you could sell your most valuable product-
Review the case of identity theft : - In your opinion, what would be your plan to review the case of identity theft toward the university professors? Why?
Post addresses mary moore : Do you think that a culture of honesty, openness, and assistance can exist as suggested by Ms. Moore and Or is it a utopian idea with no understanding of how human nature works?
When evaluating the hypothesis of a research : What questions should be ask when evaluating the hypothesis of a research paper? What should be look at when evaluating the method section of a research paper?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Design for storing the maze layout

Design and implement a C++ program for maze layout

  Public transport fare ticketing system

Implement and test a public transport fare ticketing system.

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Write program that stores the numbers in array

Write a c++ program that stores the following numbers in the array named miles: 15,22,16,18,27,23, and 20. have your program copy the data stored in miles to another array.

  C assignment of curl library

C Assignment Curl library must be used To be done on linux, it should be compiled using the following command: gcc -Wall -ansi -pedantic NameOfFile.c -lncurses Please make sure it is commented with clarification Variable names in camel case

  Construct vector and linked lists data structures

You will prepare sorted versions of the Linked Lists and Vector data structures developed in class

  Write a menu-driven program that maintains an address book

Write a menu-driven program that maintains an address book using a linked list. The address book must supports the following operations

  Prepare a linux shell

Prepare a linux shell (in other words, write a C/C++ program) that will recursively prompt for input from the user. The shell should prompt as

  Pros and cons of choosing two servers

Classify the two alternatives in terms of what type of application architecture they use. b. Outline the pros and cons of the two alternatives and make a recommendation to Fred about which is better.

  Basics of code development on linux and cryptography

Prepare a C program that gives simple mono-alphabetic substitution between plaintext, and Enhance your code to use "-e" to encrypt a string argument and "-d" to decrypt it using argv and argc

  Create class having constructor to recieve two ints

Create a class (in C++)named Card. The class should have two int data members named face and suit.The class should have a constructor that recieves the two ints and uses them to initialize the data members.

  Write function that randomly produces maze

Write a function mazeGenerator that randomly produces a maze (in C++). The Function should take as arguments a two-dimensional 12-by-12 character array.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd