Modify project 2 to use functions, repeat until the user chose to exit, and validate all your entries.If the user will enter a character that other than r, c, or i. The code will output an error message and shows the menu and request a new entry.This process should repeat until the user enters a valid character.Do the same thing with numbers, if it should be within a range and/or positive then the user should be prompt to enter another value.The code should repeat by answering a question do you want to perform the new calculation. Accept y or n using any combination (upper or lower).Use at least a minimum of 5 different functions: One for each type of calculation, one to validate the user’s character entry, one to validate the positive number.Don’t forget to include everything in the main function and to call that function.Your output should be the same as project2, except when the user enters an invalid entry, then you should output an error message and ask the user to enter the value again, which should repeat until the user enters a valid entry. Then you move to the next step. When the calculation is over, output the results and ask the user if they would like to run the code again, if the user enters y then you run it again. Exit otherwise.My project2:# Get input from the usercustomer_code = str(input(“Enter the customer’s code: “))start_meter = int(input(“Enter the customer’s beginning meter reading: “))end_meter = int(input(“The customer’s ending meter reading: “))valid_input = [‘R’, ‘r’, ‘I’, ‘i’, ‘C’, ‘c’] # Array of valid inputs to test from# If there is anything invalid about the user input then print invalid entryif not(customer_code in valid_input) or start_meter – 999999999 > 0 or end_meter – 999999999 > 0 or start_meter < 0 or end_meter < 0: print('Invalid Entry.nGallons of water used: 0.0 nAmount billed: $0.0')else: # Start off by printing the users inputs print("Customer code: ", str(customer_code)) print("Beginning meter reading: ", '{:0=9}'.format(start_meter)) print("Ending meter reading: ", '{:0=9}'.format(end_meter)) # Make sure to set the proper amount of water used as it is valid for start_meter to be greater than end_meter if end_meter > start_meter: water_used = (end_meter – start_meter) / 10 else: water_used = (end_meter + 1000000000 – start_meter) / 10 # Check each piece of valid customer code and depending on the code perform the correct action if customer_code == ‘R’ or customer_code == ‘r’: amount = 5 + (0.0005 * water_used) print(f”Gallons of water used: {‘%.1f’ % round(water_used, 2)}”) print(f”Amount billed: $ {‘%.2f’ % round(amount, 2)}”) elif customer_code == ‘C’ or customer_code == ‘c’: print(f”Gallons of water used: {‘%.1f’ % round(water_used, 2)}”) if water_used <= 4000000.0: amount = 1000.0 print(f"Amount billed: $ {'%.2f' % round(amount, 2)}") else: amount = 1000.0 + (0.00025 * (water_used - 4000000)) # Make sure to only multiply the excess water_used print(f"Amount billed: $ {'%.2f' % round(amount, 2)}") elif customer_code == 'I' or 'i': print(f"Gallons of water used: {'%.1f' % round(water_used, 2)}") if water_used <= 4000000.0: amount = 1000.0 print(f"Amount billed: $ {'%.2f' % round(amount, 2)}") elif 4000000.0 < water_used <= 10000000.0: amount = 2000.0 print(f"Amount billed: $ {'%.2f' % round(amount, 2)}") elif water_used > 10000000.0: amount = 2000.0 + (0.00025 * (water_used – 10000000)) # Make sure to only multiply the excess water_used print(f”Amount billed: $ {‘%.2f’ % round(amount, 2)}”)Computer ScienceEngineering & TechnologyPython Programming Aj 012
solved : Modify project 2 to use functions, repeat until the user cho
How it works
- Paste your instructions in the instructions box. You can also attach an instructions file
- Select the writer category, deadline, education level and review the instructionsÂ
- Make a payment for the order to be assigned to a writer
- Â Download the paper after the writer uploads itÂ
Will the writer plagiarize my essay?
You will get a plagiarism-free paper and you can get an originality report upon request.
Is this service safe?
All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades
LET THE PROFESSIONALS WRITE YOUR PAPER!