In this lab, you complete a partially written Python program that computes hotel guest rates at Cornwall’s Country Inn.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In this lab, you complete a partially written Python program that computes hotel guest rates at Cornwall’s Country Inn.

Post by answerhappygod »

In this lab, you
complete a partially written Python program that computes hotel
guest rates at Cornwall’s Country Inn.
The program is
described in Chapter 9, Exercise 11, in Programming Logic
and Design. In this program, you should include a function
named computeRate(). It should accept the number of days and
calculate the rate at $99.99 per day.
It should optionally
include a code for a meal plan. If the code is A, three meals per
day are included, and the price is $169.00 per day. If the code is
C, breakfast is included, and the price is $112.00 per day. All
other codes are invalid.
The function returns
the rate to the calling program where it is displayed. The main
program asks the user for the number of days in a stay and whether
meals should be included; then, based on the user’s response, the
program either calls the function or prompts for a meal plan code
and calls the function. Comments are included in the file to help
you write the remainder of the program.
Instructions
Grading
In This Lab You Complete A Partially Written Python Program That Computes Hotel Guest Rates At Cornwall S Country Inn 1
In This Lab You Complete A Partially Written Python Program That Computes Hotel Guest Rates At Cornwall S Country Inn 1 (75.01 KiB) Viewed 88 times
Tasks Cornwall.py > Terminal 1 The rate for your stay is: 338.. How many days do you plan to stay?: 0 Show Details lil Calculation 2 OSC Quote Quid 10.00 O out of 1 checks passed. Review the results below for more details 3 def computeRate(days, code='0'): 4 if code=='A': 5 return 169 days G 6 elif code'c': 7 return 112 days 8 else: 9 return days*99.99 10 if .name.. == 'main': 11 rate = 0.00 12 dayString = input("How many days do you plan to stay?:") 13 days = int(dayString) 14 question = input("Do you want a meal plan? Y or N: ") 15 if question == 'Y': 16 code=input('Enter A for 3 meal per day plan, or C for only breakfast plan: ') 17 rate-computeRate (days.code) 18 else: 19 rate computeRate(days) 20 print('Calculated rate = $4.2f}'-format(rate)) 21 Checks Test Case Incomplete Output test 2 Input 2 N Output How many days do you plan to stay?: 2 Do you want a meal plan? Y or N: N Calculated rate = $199.98 Results The rate for your stwy in 199.08 Show Details computeRate() validation 1 computeRate() validation 2 > Run checks Submit 50%

ITI Tasks Cornwall.py > Terminal Calculation 1 How many days do you plan to stay?: 0 QUOD aut of 10.00 </> O out of 1 checks passed. Review the results below for more details. Checks Test Case Incomalate 1 2 3 def computeRate(days, code='0'): 4 if code=='A': 5 return 169 days 6 elif code='c': 7 return 112 days 8 else 9 9 return days*99.99 10 if -name.. == 'main': 11 rate = 0.00 12 dayString = input("How many days do you plan to stay?:") 13 days = int(dayString) 14 question = input("Do you want a meal plan? Y or N: ") 15 if question == 'Y': 16 code=input('Enter A for 3 meal per day plan, or C for only breakfast plan: ') 17 rate-computeRate (days.code) 18 else: 19 rate computeRate(days) 20 print('Calculated rate = $4.2f}'-format(rate)) 21 Output test 1 Input 2 Y A Output How many days do you plan to stay?: 2 Do you want a meal plan? Y or N: Y Enter A for 3 meal per day plan, or C for only Calculated rate = $338.00 Results The rate for your athy is: 338. Show Details Calculation 2 QUOD out of 10.00 O out of 1 checks passed. Review the results below for more details (3) Run checks Submit 50%
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply