program2 if

program2 if - minutesDay = minutesDay * .1 amountDue = 25 +...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Kristin Gumbert CSC 135 Frye MWF 10-10:50 Program #2- if and switch statements (cell phone bill) Planning: Calculate and print the bill for a cellular telephone company. The rates depend on the type of service. Analysis: Inputs- account number, service code, number of minutes used, if premium: day minutes, night minutes. Outputs- account number, type of service, number of minutes the telephone service was used, about due from the user. Formula- Regular service: if minutesAmt < 50 amountDue = 10 else minutesAmt = minutesAmt – 50 minutesAmt = minutesAmt * .2 amountDue = 10 + minutesAmt Premium Service: if minutesDay < 75 amountDue = 0 else minutesDay = minutesDay – 75
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: minutesDay = minutesDay * .1 amountDue = 25 + minutesDay if minutesNight&lt; 100 amountDue = 0 else minutesNight = minutesNight 100 minutesNight = minutesNight * .05 amountDue = 25 + minutesNight Constraints- minutes must be greater than 0, code must start with p or r Assumptions- all numbers are positive Design: 1. Get Input a. account number b. service code c. number of minutes used d. if premium: day minutes, night minutes 2. Calculations a. Amount due 3. Print Output a. Account number b. Type of service c. Number of minutes the telephone service was used d. Number of minutes the service was used during the night...
View Full Document

This note was uploaded on 04/07/2008 for the course CSC 135 taught by Professor Frye during the Fall '07 term at Kutztown.

Ask a homework question - tutors are online