Concept explainers
Write a
a. Any call started between 8:00 am and 6:00 pm, Monday through Friday, is billed at a rate of $0.40 per minute.
b. Any call starting before 8:00 am or after 6:00 pm, Monday through Friday, is charged at a rate of $0.25 per minute.
c. Any call started on a Saturday or Sunday is charged at a rate of $0.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 24-hour notation, so the time 1:30 pm is input as
13:30 |
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:
Mo Tu We Th Fr Sa Su |
Be sure to allow the user to use either uppercase or lowercase letters or a combination of the two. The number of minutes will be input as a value of type int. (You can assume that the user rounds the input to a whole number of minutes.) Your program should include a loop that lets the user repeat this calculation until the user says she or he is done.
Learn your wayIncludes step-by-step video
Chapter 3 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting out with Visual C# (4th Edition)
Starting Out with Python (3rd Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Software Engineering (10th Edition)
- An Internet service provider has three different subscription packages for its customers:Package A: For $9.95 per month 10 hours of access are provided. Additional hours are $2.00per hour.Package B: For $13.95 per month 20 hours of access are provided. Additional hours are $1.00per hour.Package C: For $19.95 per month unlimited access is provided.Write a program that calculates a customer’s monthly bill. It should ask the user to enter theletter of the package the customer has purchased (A, B, or C) and the number of hours thatwere used. It should then display the total charges. Please program in C++ Requirements: Please include a Flowchart and the pseudocode for your programarrow_forwardAn International Internet phone company has three different subscription packages for its customers:Package A: For $9.95 per month 5 hours of call time are provided. Additional usage costs $0.08 per minute.Package B: For $14.95 per month 10 hours of call time are provided. Additional usage costs $0.06 per minute.Package C: For $19.95 per month unlimited call time is provided.Write a program that calculates a customer’s monthly bill. It should input customer name, which package the customer has purchased, and how many hours were used. It should then create a bill that includes the input information and the total amount due. Wherever possible use named constants instead of numbers.arrow_forwardWrite a C program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium, each with varying rates based on usage.The rates are computed as follows:Regular service:- $10.00 base charge with the first 50 minutes being free.- Charges for usage beyond 50 minutes are $0.20 per minute.Premium service:- $25.00 base charge with different rates for day and night usage: a. For calls made from 6:00 a.m. to 6:00 p.m., the first 75 minutes are free, and charges for usage beyond 75 minutes are $0.10 per minute. b. For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free, and charges for usage beyond 100 minutes are $0.05 per minute.The program should prompt the user to enter an account number, a service code (as a character), and the number of minutes the service was used. A service code of 'r' or 'R' represents regular service, while 'p' or 'P' represents premium service. Any other character should be…arrow_forward
- Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of service: regular and premium. Its rates vary, depending on the type of service. The rates are computed as follows:Regular Service: $10.00 plus first 50 minutes are free. - Charges for over 50 minutes are $0.20 per minute.Premium service: $25.00 plus - For calls made from 6:00 a.m. to 6:00 p.m.,the first 75 minutes are free;charges for more than 75 minutes are $0.10 per minute.- For calls made from 6:00 p.m. to 6:00 a.m., the first 100 minutes arefree; charges for more than 100 minutes are $0.05 per minute.Your program should prompt the user to enter an account number, a service code (type char), and the number of minutes the service was used. A service code of r or R means regular service; a service code of p or P means premium service. Treat any other character as an error. Your program should output the account number, type of service, number of minutes the telephone…arrow_forwardWrite a program that computers and assess the tuition fee of the students in one trimester, based on the given mode of payment below:Plan(key) Discount/interestCash(1) 10% discountTwo-Installment 5%interestThree-Installment 10% interestSample input/output dialogue:Enter Tuition Fee: 20000Enter Mode of Payment: 2Your total tuition fee is : 21000arrow_forwardwrite a program to calculate electricity bill charged to a consumer.Ask him to enter the unit consumed.for all units less than or epual to 200,each unit is to be charged at RS.2.if unit is greater than 200 and less than or equal to 400, first 200 units is to be charged at RS. 2 and other units is charged at Rs. 4. Each unit more than 400 will be charged at RS. 5.arrow_forward
- WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. WRITE A PROGRAM TO CALCULATE THE SIMPLE INTEREST ON A LOAN AMONUT OF 50000 GHANA CEDIS AT AN INTEREST RATE OF 30% FOR A NUMBER OF YEARS WHICH WILL BE SPECIFIED BY THE USER. WRITE A PROGRAM TO CALCULAT THE AGE OF THE USER AFTER THE USER ENTERS HIS OR HER YEAR OF BIRTH.arrow_forwardWrite a program that computes and displays the charges for a patient’s hospital stay. First, the program should ask if the patient was admitted as an in-patient or an out-patient. If the patient was an in-patient the following data should be entered: • The number of days spent in the hospital• The daily rate• Charges for hospital services (lab tests, etc.)• Hospital medication charges.If the patient was an out-patient the following data should be entered:• Charges for hospital services (lab tests, etc.)• Hospital medication charges.Use a single, separate function to validate that no input is less than zero. If it is, it should be re-entered before being returned.Once the required data has been input and validated, the program should use two overloaded functions to calculate the total charges. One of the functions should accept arguments for the in-patient data, while the other function accepts arguments for out- patient data. Both functions should return the total charges.arrow_forwardYou are working for a lumber company, and your employer would like a program that calculatesthe cost of lumber for an order. The company sells pine, fir, cedar, maple, and oak lumber.Lumber is priced by board feet. One board foot equals one square foot that is one inch thick. Theprice per board foot is given in the following table: (image 1) The lumber is sold in different dimensions (specified in inches of width and height, and feet oflength) that need to be converted to board feet. For example, a 2 x 4 x 8 piece is 2 inches wide, 4inches high, and 8 feet long, and is equivalent to 5.333 board feet (2 * 4 * 8 = 64, which whendivided by 12 = 5.333 board feet). An entry from the user will be in the form of a letter and fourinteger numbers. The integers are the number of pieces, width, height, and length. The letter willbe one of P, F, C, M, O (corresponding to the five kinds of wood) or T, meaning total. When theletter is T, there are no integers following it on the line. The program…arrow_forward
- A mobile phone service provider has three different subscription packages for its customers: Package A: For $39.99 per month, 450 minutes are provided. Additional minutes are $0.45 per minute. Package B: For $59.99 per month, 900 minutes are provided. Additional minutes are $0.40 per minute. Package C: For $69.99 per month, unlimited minutes are provided. Write a program that calculates a customer’s monthly bill. It should ask the user to enter the letter of the package the customer has purchased (A, B, or C) and the number of minutes that were used. The program should display the total charges.arrow_forwardWrite a program that reads from a student his/her name and his/her ID which is formed of 8 digits. The program should display the day of registration and the starting hour of registration according to the below tables. First 4 digits to the left Registration Day Monday Tuesday WEdnesday 2018 2019 2020 First digit to the right Registration IHour 4 6 10 7-8arrow_forwardWrite a program that will calculate and print out bills for the city water company. The water rates vary depending on whether the water is for home use, commercial use or industrial use. A code of H means home use, a code of c means commercial use and a code of I means industrial use. The water rates are computed as follows: code H: P250.00 plus P0.002 per gallon used code c: P5,000.00 for the first 4 million gallons and P0.002 for each additional gallon. code I: P8,000 if usage does not exceed 4 million gallons, P14,000 if usage is more than 4 million gallons but not more that 10 million gallons and P18000 if usage exceeds 10 million gallons. Your program should prompt the user for the code and the gallons of water used. Your program should echo your input data and should print the amount due from the user. Your program should use a switch statement for the code (char data type). Use the float data type for the…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education