{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

program2 if

# program2 if - minutesDay = minutesDay.1 amountDue = 25...

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

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
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< 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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern