Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

By using python language please .. thank you Problem Definition Write a Python program that calculates and prints the bill for a cellar telephone company.

By using python language please .. thank you image text in transcribed
image text in transcribed
Problem Definition Write a Python program that calculates and prints the bill for a cellar telephone company. The company offers two types of services: regular and premium. Its rates vary depending on the type of the service. The rates are computed as follows service: 10 Omani Rials plus: - The first 50 minutes are free Charges for over 50 minutes are 200 Baiza per minute Premium service 25 Omani Rials plus: For calls made during the day from 6:00 a.m. to 6:00 p.m., the first 75 minutes are free; charges for over 75 minutes are 10 Baiza per minute. For calls made during the night from 6:00 p.m. to 6:00 a.m., the first 100 minutes are free: charges for over 100 minutes are 5 Baiza per minute Your program should prompt the user to enter an account number, a service code type, 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 for the service code as an error. Give an error message for negative number of minutes used For the premium service, the customer may use the service during the day and the night. Therefore, to cakulate the bil, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service was used during the night Use readable variable names and define appropriate named constants for various cost rates and boundary minutes values. Your program shoukd output the account number, type of service, number of minutes the telephone service was used, and the amount due, in the format shown in the sample runs (See Figures 1(a)-1(h)). Test your program thoroughly Enter account number: 11223344 Enter service type: (ror R) for regular, (por P) for premium service: q Error: Invalid service type Enter account number 11223344 Enter service type: (ror R) for regular, (p or P)for premium service:r Enter number of minutes used:-90 Error: Invalid minutes used Figue (a): Invalid service type Figure 1 (b): Invalid minutes used account nusberI 12345678 service types (r or R) for regular, (p or P) for prenlue service number of minutes used: 0 Eeter accountusberi 11223344 Enter service types (ror R) for repular, (p or P) for prenium services Enter nunber of minutes service used: 86 Service Type Service Type REnutes Used Regular Repalar Figure (c): Regular service, below 50 minutes Figure (d): Regular service, exceeding 50 minutes Enter account number: 11112222 Enter service type: (r or R) for regular, (p or P) for premium service: p Enter day time minutes used: 70 Error: Invalid day minutes used. Enter account number: 11112222 Enter service type: (ror R) for regular, (p or P)for premium service:P Enter day time minutesused: 80 Enter night time minutes used:-70 Error: Invalid night minutes used. Figure 1 (e): Premium service, invalid day minutes used Figure 1 (): Premium service, invalid night minutes used Enter account nuebers 33339999 Enter service type (r or R) for regular, (p or P) for premiun service Enter day tine minutes used: 7 Enter night tine minutes used: 100 Enter account hunber 12345678 Enter service type: ( or R) for regular, (p or P) for preniue service: p Enter day tine minutes used: 88 Enter night tiee minutes used: 200 Account Nunber Service Type Minutes used Anount Due Account Nunber Service Type Minutes used 33339999 Preniun (Day) 7 MR25-000 12345678 Preniun (Day) 88 (Night) 200 ight)100 Figure 1 (g): Premium service, not exceeding day and night Figure minutes used (h): Premium service, exceeding day and night minutes used a) Use named constants, meaningful variable names, and meaningful comments to describe the solution b) Accept service type in lowercase or uppercase form (e.g. p and P are both valid options)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions