subject

The following (unfinished) program implements a digital line queuing system for an amusement park ride. The system allows a rider to reserve a place in line without actually having to wait. The rider simply enters a name into a program to reserve a place. Riders that purchase a VIP pass get to skip past the common riders up to the last VIP rider in line. VIPs board the ride first. (Considering the average wait time for a Disneyland ride is about 45 minutes, this might be a useful program.) For this system, an employee manually selects when the ride is dispatched (thus removing the next riders from the front of the line). Complete the following program, as described above. Once finished, add the following commands:
The rider can enter a name to find the current position in line. (Hint: Use the list. index() method.)
The rider can enter a name to remove the rider from the line.

riders_per_ride = 3 # Num riders per ride to dispatch
line = [] # The line of riders
num_vips = 0 # Track number of VIPs at front of line
menu = ('(1) Reserve place in line.\n' # Add rider to line
'(2) Reserve place in VIP line.\n' # Add VIP
'(3) Dispatch riders.\n' # Dispatch next ride car
'(4) Print riders.\n'
'(5) Exit.\n\n')
user_input = input(menu).strip().lower()
while user_input != '5':
if user_input == '1': # Add rider
name = input('Enter name:').strip().lower()
print(name)
line. append(name)
elif user_input == '2': # Add VIP
print('FIXME: Add new VIP')
# Add new rider behind last VIP in line
# Hint: Insert the VIP into the line at position num_vips.
#Don't forget to increment num_vips.
elif user_input == '3': # Dispatch ride
print('FIXME: Remove riders from the front of the line.')
# Remove last riders_per_ride from front of line.
# Don't forget to decrease num_vips, if necessary.
elif user_input == '4': # Print riders waiting in line
print('%d person(s) waiting:' % len(line), line)
else:
print('Unknown menu option')
user_input = input('Enter command: ').strip().lower()
print(user_input)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:30
Primary tech skills are skills that are necessary for success in online education
Answers: 3
question
Computers and Technology, 22.06.2019 19:20
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_balance should be removed since header files should not contain constants.c)the definition of cashregister should be removed since header files should not contain class definitions.d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
What is the worst-case complexity of the maxrepeats function? assume that the longest string in the names array is at most 25 characters wide (i.e., string comparison can be treated as o( class namecounter { private: int* counts; int nc; string* names; int nn; public: namecounter (int ncounts, int nnames); int maxrepeats() const; }; int namecounter: : maxrepeats () { int maxcount = 0; for (int i = 0; i < nc; ++i) { int count = 1; for (int j = i+1; j < nc; ++j) { if (names[i] == names[j]) ++count; } maxcount = max(count, maxcount); } return maxcount; }
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
Researchers measured the data speeds for a particular smartphone carrier at 50 airports. the highest speed measured was 78.1 mbps. the complete list of 50 data speeds has a mean of x overbarequals16.11 mbps and a standard deviation of sequals18.65 mbps. a. what is the difference between carrier's highest data speed and the mean of all 50 data speeds? b. how many standard deviations is that [the difference found in part (a)]? c. convert the carrier's highest data speed to a z score. d. if we consider data speeds that convert to z scores between minus2 and 2 to be neither significantly low nor significantly high, is the carrier's highest data speed significant? a. the difference is nothing mbps.
Answers: 3
You know the right answer?
The following (unfinished) program implements a digital line queuing system for an amusement park ri...
Questions
question
English, 25.06.2019 07:40
question
English, 25.06.2019 07:50
question
Mathematics, 25.06.2019 07:50