Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project Objectives . . Decision-making with if, if-else, if-elif-.. Data validation (and correction and use of default) for user input using a while loop. Nicely

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

Project Objectives . . Decision-making with if, if-else, if-elif-.. Data validation (and correction and use of default) for user input using a while loop. Nicely formatted output report using format strings (using the {:} approach) with the format function. Multiple input data sets (i.e., for multiple Packages). Inside-out incremental development of the program. Use PyCharm IDE rather than IDLE. . Python Language Elements: . . Follow python naming conventions for variables and constants. Use good descriptive naming for variables/constants. The top comment must include your name, project number, lab section, and brief project description. Project Overview An Internet service provider has three different subscription packages for its customers: Package A: Package B: For $10.00 per month 10 hours of access are provided. Additional hours or any fraction thereof are $2.50 per hour. For $20.50 per month 20 hours of access are provided. Additional hours or any fraction thereof are $2.00 per hour. For $35.00 per month unlimited access is provided. Package C: Write a program that will: . Ask the user to enter the package designation, which should be A, B, or C. If the user enters a, b, or c (i.e., lower case), the program should accept this. Otherwise, keep asking until a valid letter is entered. Also, any leading trailing white space on the input should be trimmed off. Ask for the number of hours used as a decimal fraction (a floating-point number). Validate the number and if it is invalid, keep asking the user for a valid number. If it is valid, round the number of hours up to the next integer value. Even though if it is a whole number, it can remain stored in a float. Report the number of hours that will be charged. Process the valid input as follows: o Compute the total monthly costs for each of the plans. o Using if-elif structure, identify the plan that was input and print the charges. Also, compare the cost to the other two plans and if either or both are cheaper, report how much the user could have saved by using that plan. Repeat the entire process as long as the User agrees. . Deliverables The deliverable for this project is the following file: proj02_LastName.py Be sure to use the specified file name and submit it for grading via eLearning before the project deadline. Stages of the Program Development 0) The program hardcodes "input data for ONE package, does appropriate calculations & produces the output. 1) AFTER STAGE O WORKS CORRECTLY The program gathers input data for ONE package from the user instead of using hardcoded "input" data but does not do any data validation on the input. 2) AFTER STAGE 1 WORKS CORRECTLY Add data correction & validation (see the rules below) for handling input (for ONE package) 3) AFTER STAGE 2 WORKS CORRECTLY Add looping so that the program can handle as many packages as the user provides. (After handling one package, the program asks whether the user wants to enter data for another package, then proceeds accordingly). The stage 3 version of the program is the one that you should submit to get the full 100 points. INPUT (for 1 package) Use appropriate prompts to get these 2 data items from the user: plan letter and number of hours INPUT CORRECTION & VALIDATION (added in stage 2) O Plan letter must be one of A, B, C (in prompt, you asked for A or B or C) Before checking for validity, do 2 things to help the user by fixing certain things: Grab just the Oth char they entered in case if they type in Lower case), char = input_str[0] Capitalize that first char, cap_char = charo.upper() If it's invalid, keep asking the user for a valid plan letter until they enter something correctly. The number of hours must be a positive number (a floating-point number). If it's invalid, keep asking the user for a valid number of hours until they enter something correctly. To summarize, the two inputs, that is the plan letter and the number of hours should have their own validation loops. o . O INPUT - MULTIPLE PACKAGES (added in stage 3) After handling a single PACKAGE (IPO for it: input/validate the data, do calculations, print the report of the charges), ask the user if they wish to enter another package (YES or NO). If they enter YES (or Yes or yes or YES or yes or yellow or...) or Y (or y), then go around the big loop again. Use the 2 String methods to (1) grab just the 1st char and (2) capitalize it to reduce the number of cases that need to be checked to just the single case 'Y' (so that'd include yup, yea, yo, yellow, ...) Any other response (like Noo/Nopeaw/whatever/who cares/red/green....) will be assumed to be a NO. O Sample Output (use EXACT format and NO HARDCODING of the data itself) Enter your plan letter (A, B, or C): b Enter your number of hours: 28.7 Your usage charge is for 29 hours. Your charges for Package B are $38.50 With Package C you would have saved $3.50 (Notice all the extra spaces before the input b'. They were removed by the program.) Do you want to enter another package? Y Enter your plan letter (A, B, or C): A Enter your number of hours: 65 Your usage charge is for 65 hours. Your charges for Package A are $147.50 With Package B you would have saved $37.00 With Package C you would have saved $112.50 Do you want to enter another package? yes a Enter your plan letter (A, B, or C): k You entered an invalid plan code K. Enter your plan letter (A, B, or C): Enter your number of hours: 65 Your usage charge is for 65 hours. Your charges for Package A are $147.50 With Package B you would have saved $37.00 With Package C you would have saved $112.50 Do you want to enter another package? yep Enter your plan letter (A, B, or C): Y You entered an invalid plan code Y. Enter your plan letter (A, B, or C): b Enter your number of hours: -20.0 You entered an invalid number of hours. Enter your number of hours: 28.1 Your usage charge is for 29 hours. Your charges for Package B are $38.50 With Package C you would have saved $3.50 Do you want to enter another package? No

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

More Books

Students also viewed these Databases questions