Pseudocode- CH
.docx
keyboard_arrow_up
School
Dallas County Community College *
*We aren’t endorsed by this school
Course
1436
Subject
Information Systems
Date
Feb 20, 2024
Type
docx
Pages
6
Uploaded by ChefComputerNarwhal18
Pseudocode for the six functions:
1)
main_menu():
Display the list of retreats and their corresponding codes
Prompt the user to enter the code of the retreat they are interested in
Call the corresponding function based on the user's choice
Repeat until the user chooses to exit
2)
burgundy():
Declare the base charge, leadership instruction charge, and required equipment charge as global constants
Prompt the user to enter the number of people attending the retreat
Calculate the total cost by adding up the base charge, leadership instruction charge, and required equipment charge multiplied by the number of attendees
Display the total cost
3)
scott():
Declare the base charge and leadership instruction charge as global constants
Prompt the user to enter the number of people attending the retreat
Prompt the user to enter the number of days they will be lodging
Prompt the user to choose whether they want luxury lodging or not
Calculate the lodging charge based on the number of days and the chosen lodging type
Calculate the total cost by adding up the base charge, leadership instruction charge, and lodging charge multiplied by the number of attendees
Display the total cost
4)
cox():
Declare the base charge as a global constant
Prompt the user to enter the number of people attending the retreat
Prompt the user to enter the number of days they will be lodging
Prompt the user to choose whether they want luxury lodging or not
Calculate the lodging charge based on the number of days and the chosen lodging type
Calculate the total cost by adding up the base charge and lodging charge multiplied by the number of attendees
Display the total cost
5)
johnson():
Declare the base charge and equipment charge as global constants
Prompt the user to enter the number of people attending the retreat
Prompt the user to enter the number of days they will need equipment
Calculate the equipment charge based on the number of days and the number of attendees
Calculate the total cost by adding up the base charge and equipment charge
Display the total cost
6)
exit_program():
Display a message thanking the user for using the program
Exit the program
// Global Constants
RON_BASE = 350.0
MICHAEL_BASE = 1000.0
COX_BASE = 400.0
JOHNSON_BASE = 700.0
// Main Function
function main():
while True:
choice = menu()
if choice == 1:
burgundy()
elif choice == 2:
scott()
elif choice == 3:
cox()
elif choice == 4:
johnson()
else:
break
// Menu Function
function menu():
display "Select a retreat:"
display "1. The Ron Burgundy People Know Me Retreat"
display "2. The Michael Scott World's Best Boss Retreat"
display "3. Dr. Cox Presents Man Not Caring Retreat"
display "4. Tony Johnson's I Really Don't Care Retreat"
display "5. Exit"
input user_choice
return user_choice
// Burgundy Function
function burgundy():
input "Enter the number of participants: ", participants
total_cost = (RON_BASE + 100 + 40) * participants
display "Total cost for The Ron Burgundy People Know Me Retreat: ", total_cost
// Scott Function
function scott():
input "Enter the number of participants: ", participants
total_cost = (MICHAEL_BASE + 100) * participants
display "Total cost for The Michael Scott World's Best Boss Retreat: ", total_cost
// Cox Function
function cox():
input "Enter the number of participants: ", participants
input "Enter the number of days: ", days
input "Select lodging type (1 for regular, 2 for luxury): ", lodging_type
lodging_cost = (65 if lodging_type == 1 else 120) * days
total_cost = (COX_BASE + lodging_cost) * participants
display "Total cost for Dr. Cox Presents Man Not Caring Retreat: ", total_cost
// Johnson Function
function johnson():
input "Enter the number of participants: ", participants
input "Enter the number of days: ", days
total_cost = (JOHNSON_BASE + 40 * days) * participants
display "Total cost for Tony Johnson's I Really Don't Care Retreat: ", total_cost
Here is the C++ implementation of the pseudocode:
#include <iostream>
#include <iomanip>
// Global Constants
const double RON_BASE = 350.0;
const double MICHAEL_BASE = 1000.0;
const double COX_BASE = 400.0;
const double JOHNSON_BASE = 700.0;
// Function Prototypes
int menu();
void burgundy();
void scott();
void cox();
void johnson();
int main() {
int choice;
do {
choice = menu();
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help