Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 231 Project 02. In need of help, Code for this project would be much appreciated. The last picture is what I have so far

CSE 231 Project 02. In need of help, Code for this project would be much appreciated. The last picture is what I have so far but do not know where to go from there. Needs do be done on Python please help

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

This assignment focuses on the design, implementation and testing of a Python program which uses control structures to solve the problem described below. It is worth 20 points ( 2% of course grade) and must be completed no later than 11:59 PM EST on Monday, January 23. After the due date, your score will be dedacted by lpt for every 2 hours late. Assignment Overview (learning objectives) This assignment will give you more experience on the use of: - integers (int) - conditionals - itention - input output Assignment Specifications With Foraa Horizon 5 set to release in early November, Xbox Game Stucios is working feverishly to add in last minute mechanics and to test new ideas! The catch? They need these mechanics in Python, not in C= ! One of these ideas is the ability to rent cars, but there needs to be a calculator to do that! Project 2 will be able to compute and display information for a company which rents vehicles to its customers/players in the game. For a specified customer/player, the program will compute and display the amount of money charged for that customer/player's vehicle rental. Since the code is for the Xbos edition, our input is going to be based on an Xbox controller! 1. The progrnm should start by asking the user if he wants to continue. The answer is A for yes or ' B ' for no. You can check the value with Boolean expressions such as or answer!=A. The basic structure of the main loop is Prompt to see if the user wants to continue While the value is "A": All your other code goes here Prompt to see if the user wants to continue 2. It will then continue to prompt the user to enter the following four items for a given customer (in the specified order): a. The customer's classification code (a character) b. The mumber of days the vehicle was rented (an integer) c. The vehicle's odometer reading at the start of the rental period (an integer) d. The vehicle's odometar reading at the end of the rental period (an integer) It will then process that customer information and display the results. At the end, the program should ask the user if he wants to process another request and it will keep asking until the user enters "B". 3. The program will compute the amount of money that the player will be billed, based on the player's classification code, number of days in the rental period, and number of niles driven. The program will only recognize upper case letters for the classification codes. Code 'BD' (budget) base charge: $40.00 for each day mileage charge: $0.25 for each mile driven Code 'D' (daily) base charge: $60.00 for each day mileage charge: no charge if the average number of miles driven per day is 100 miles or less; otherwise, $0.25 for each mile driven above the 100 mile per day limit. Code 'W' (weekly) base charge: $190.00 for each week (or fraction of a week) mileage charge: no charge if the average number of miles driven per week is 900 miles or less; $100.00 per week if the average number of miles driven per week exceeds 900 miles but does not exceed 1500 miles; otherwise, $200.00 per week phus $0.25 for each mile driven above the 1500 mile per week limit. (Note: if you rent for 8 days that is more than one week so the base rate is for 2 weeks - hint use math. ceil [1]. Also, you are to take the total miles and subtract 1500 'weeks to get the miles you will be charging for.) The amount billed to the player is the sum of the base charge and the mileage charge. 4. The program will compute the number of miles driven by the player during the rental period. The odometer readings are taken from an odometer which has sis digits and records tenths of a mile. 5. For each player, the program will cisplay a summary with the following information: a. The player's classification code b. The number of days the vehicle was rented c. The vehicle's odometer reading at the start of the rental period d. The vehicle's odometer reading at the end of the rental period. e. The number of miles driven during the rental period f. The amount of money billed to the player for the rental period All output will be appropriately labeled and formatted. The number of miles driven will be rounded to one fractional digit. The amount of money billed will be displayed with a dolar sign and will be rounded to two fractionsl digits (for example, $125.99 or $43.87 ). Note that we do not have the ability yet to fine tune the output so if cents end in zero that final zero will not be displayed-that is fine for this project. We provide a file strings . tat with the strings we used to make it easier for you to match our output. 6. The program will detect, report and recover from invalid classification codes. When an invalid classification code is detected, the program will display an error message and re-prompt until a correct classification code is entered. Hint: use a while loop that will loop until a comect classification code is entered. Here is pseudo code of that loop: Prompt for a value While the value is not correct Print an error message Prompt for a value 7. The program will assume that all other user inputs are valid and conect. That is, the program will not check the number of days or odometer readings for validity. However, as noted below you may encounter an ending odometer reading that is less than the beginning reading and you need to handle that correctly. Assignment Deliverable The deliverable for this assignment is the following file: proj02.py - the source code for your Python program Be sure to use the specified file name and to submit it for grading via the Coding Rooms before the project deacline. Assignment Notes 1. As stated above, the odometer's dial has six digits and records tenths of a mile. For esample, if the beginning reading was 100003 and the ending reading was 100135 , then the player drove 13.2 miles chung the rental period. 2. Since the odometer's dial is fived with only six digits, the reacing at the end of the rental period may be less than the reading at the beginning of the billing period. For example, if the beginning reading was 999997 and the ending reading was 000005 , then the player drove 0.8 miles curing the rental period. You need to handle that arithmetic conrectly. 3. Be sure to prompt the user for the four inputs in the specified order and, your program cannot prompt the user for any supplementary inputs. 4. The structure of the main loop is as follows (in psendo-code): Prompt for an input \#for example, answer = input (... while Boolean: \#Boolean expression uses input such as "answer" \# all your code goes here Prompt for an input (same statement used above) 5. It isn't necessary for the user to type leading zeroes when entering odometer readings. However, it doesn't hurt anything, either. 6. Coding Standards 16 will be enforced. 7. You are not allowed to use functions or advanced dita structures such as lists, dictionaries, etc. That is, things we haven't covered yet. 8. Boware of this common programming error: you may be thinking of a Boolean expression this way: m==BBDorDorW However, that evaluates to True for any value of n becanse any nou-empty string evaluates to True so that Boolean expression is equivalent to =BD or True or True whose vahe is True for any value of . The logically correct way to write that expression is x=BDorx=Dorx==W If you want the negation of that, you can do the following: not(x==BDorx==Dorx==W} Note that this next expression does not have the same value! !=BDor!=Dor!=W) Understanding why not is a usefil exercise. (For the curious lookup DeMorgan's Law.) 9. Notice that the player and the customer are the same personl The player is the customer in the game, so the program should display for a customer even though we are talking about a player. Suggested Procedure - Sone the problom using pencil and paper first. You cannot write a program until you have figured out how to solve the problem. This first step is best done collaboratively with another student. However, once the discussion tums to Python specifics and the subsequent writing of Python statements, you must work on your own. - Write a simple version of the program. Ruan the program and track down any errors. - Use the Coding Rooms system to turn in the first version of your program. - Cycle through the steps to incrementally develop your program: - Edit your program to add new capabilities. - Run the program and fis any errors. - Use the Coding Rooms system to submit your final version. - Be sure to log out when you leave the room, if you're working in a public lab. Test 1 Welcone to Horizons car rentals. At the pronpts, please enter the following: Custoner's classification code (a character: BD, D, W) Number of days the vehicle was rented [int] odoneter reading at the start of the rental period (int) odoneter reading at the end of the rental period (int) Would you like to continue (A/B) ? B Thank you for your loyalty. Test 2 Welcone to Horizons car rentals. At the pronpts, please enter the following: Custoner's classification code (a character: BD, D, W) Number of days the vehicle was rented [int] odoneter reading at the start of the rental period (int) odometer reading at the end of the rental period (int) Would you like to continue (A/B) ? R Custoner code (BD,D,W):D Number of days: 1 Odoneter reading at the start: 100003 Odoneter reading at the end: 100135 Custoner sumnary: classitication oode: D rental period (days): 1 odoneter reading at start: 100003 odoneter reading at end: 100135 number of niles driven: 13.2 amount due: \$ 60.0 Would you like to continue (A/B) ? R Customer code (BD,D,W):D Number of days: 4 Odoneter reading at the start: 101010 Odometer reading at the end: 108200 Custoner sunnary: classitication oode: D rental period (days): 4 odoneter reading at start: 101010 odometer reading at end: 108200 number of niles driven: 719.0 amount dues \& 319.75 Kould you like to oontinue (A/B) ? R Custoner code BD,D,X: D Number of days: 2 Odoneter reading at the start: 002000 Odometer reading at the end: 004000 Customer summary: classitication oode: D rental period (days): 2 odoneter reading at start: 2000 odometer reading at end: 4000 number of niles driven: 200.0 amount dues \& 120.0 Would you like to oontinue (A/B) ? R Custoner code (BD,D,W:BD Number of days: 3 Odoneter reading at the start: 999997 Odoneter reading at the end: 00000S Customer summary: classitication oode: ED rental period (days): 3 odoneter reading at start: 999997 odoneter reading at end: 5 number of niles drivens 0.8 amount dues \& 120.2 Kould you like to oontinue (A/B) ? B Thank you for your loyalty. Test 3 Welcone to Horizons car rentals. Rt the prompts, please enter the following: Customer'a classification code (a character: BD, Do, K) Number of days the vehicle was rented [1nt] Odoneter reading at the start of the rental period (int) Odoneter reading at the end of the rental period (int) Nould you like to continue (R/B)?R Customer code BD,D,X) : D Number of days: 3 Odometer reading at the start: 002000 Odometer reading at the end: 002100 Customer summary: classitication oode: D rental period (days): 3 odometer reading at start: 2000 odometer reading at end: 2100 number of niles driven: 10.0 amount due: \& 1BO.0 Would you like to continue (A/B) ? R Customer code BD,D,X : D Number of days: B Odometer reading at the start: 000200 Odometer reading at the end: 01000D Customer summary: classiticntion oode: D rental period (days): 8 odometer reading at start: 200 odoneter reading at end: 10000 number of niles drivens 980.0 amount dues $525.0 Kould you like to oontinue (A/B) ? B Thank you for your loyalty. Test 4 Welcome to Horizons car rentals. Rt the prompts, please enter the following: Customer'a classification code (a character: BD, D, K) Number of days the vehicle was rented [int] Odoneter reading at the start of the rental period (int) Odoneter reading at the end of the rental period (int) Would you like to continue (A/B) ? R Customer code (BD,D,X):W Number of days: B Odometer reading at the start: 000100 Odometer reading at the end: 040100 Customer summary: classitication code: W rental period (days): 8 odometer reading at start: 100 odoneter reading at end: 40100 number of niles driven: 4000.0 amount dues \& 1030.0 Kould you like to continue (A/B) ? R Customer code BD,D,W : W Number of days: 6 Odoneter reading at the start: 000100 Odoneter reading at the end: 001000 Customer summary: classitication oodes K rental period (days): 6 odoneter reading at start: 100 odoneter reading at end: 1000 number of niles driven: 90.0 amount due: \& 190.0 Kould you like to oontinue (A/B] ? B Thank you for your loyalty. Test 5 Welcome to Horizons car rentals. Rt the prompts, please enter the following: Custoner's classification code (a character: BD, Do, W) Number of days the vehicle was rentod [int] Odometer reading at the start of the rental period (int) Odometer reading at the end of the rental period (int) Kould you like to oontinue (A/B) ? R Customer code BD,D,X:x Invalid customer code. Try again. ** Customer code BD,D,X:Y Invalid customer code. Try again. **+ Customer code BD,D,X : W Number of dnys: 14 Odoneter reading at the start: 000100 Odoneter reading at the end: 001000 Custoner sumnary: classitication code: rental period (days) : 14 odoneter reading at start: 100 odometer reading at end: 1000 number of niles driven: 90.0 amount due: \$ 380.0 Would you like to continue (N/B) ? R Custoner code (BD, D,W):W Number of days: 15 Odoneter reading at the start: 000000 Odoneter reading at the end: 028000 Custoner sunnary: classitication oode: K rental period (days) : 15 odoneter reading at start: 0 odoneter reading at end: 28000 number of niles driven: 2800.0 amount due: $ ifo.0 Would you like to continue [A/B] ? R Custoner code (BD,D,W):W Number of days: 10 Odoneter reading at the start: 000100 Odoneter reading at the end: 090000 Custoner summary: classitication oode: W rental period (days) : 10 odoneter reading at start: 100 odoneter reading at end: 90000 number of niles driven: 8990.0 amount dues $2277.5 Would you like to continue (A/B) ? B Thank you for your loyalty

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions