Create the logic for a program that computes hotel guest rates at Cornwall\'s Co
ID: 3778901 • Letter: C
Question
Create the logic for a program that computes hotel guest rates at Cornwall's Country Inn. Include two overloaded methods named computeRate(). One version accepts a number of days and calculates the rate at $99.99 per day. The other accepts a number of days and a code for a meal plan. If the code is A, three meals per day are included, and the price is $112.00 per day. All other codes are invalid. Each method 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 first method or prompts for a meal plan code and calls the second method. Pseudocode only.
This is a basic computational thinking class. I am not asking for a specific language, rather, a simple code with constants, variables, and the solution.
Explanation / Answer
start Declarations num month num day num year 28
output “Enter the month, day, and year”
input month, day, year
displayUSDate(month, day, year)
displayUKDate(month, day, year)
displayISDate(month, day, year)
selectDisplay(month, day, year)
stop
void displayUSDate(num month, num day, num year)
output month, “-”, day, “-”, year
return
void displayUKDate(num month, num day, num year)
output day, “-”, month, “-”, year
return
void displayISDate(num month, num day, num year)
output year, “-”, month, “-”, day
return
void selectDisplay(num month, num day, num year)
Declarations
string choice
output “Enter desired display format (US, UK, or IS): ”
input choice
if choice = “US” then
displayUSDate(month, day, year)
else
if choice = “UK” then
displayUKDate(month, day, year)
else
displayISDate(month, day, year)
endif
endif
return
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.