Question: Q1. create a parking garage with Python Object-Oriented Programming Your parking gargage class should have the following methods: takeTicket This should decrease the number of

Q1. create a parking garage with Python Object-Oriented Programming

Your parking gargage class should have the following methods:

  • takeTicket
    • This should decrease the number of tickets available by 1
    • This should decrease the amount of parkingSpaces available by 1
  • payForParking
    • Display an input that waits for an amount from the user and store it in a variable
    • If the payment variable is not empty then -> display a message to the user that their ticket has been paid and they have 15mins to leave
    • This should update the "currentTicket" dictionary key "paid" to True
  • leaveGarage
    • If the ticket has been paid, display a message of "Thank You, have a nice day"
    • If the ticket has not been paid, display an input prompt for payment
      • Once paid, display message "Thank you, have a nice day!"
    • Update parkingSpaces list to increase by 1
    • Update tickets list to increase by 1

You will need a few attributes as well:

  • tickets -> list
  • parkingSpaces -> list
  • currentTicket -> dictionary

Sample output

What would you like to do? 'Show Spaces'/'Take Ticket'/'Pay Ticket'/'Leave'/'Quit' show Spaces Parking Spaces Left: 10 What would you like to do? 'Show Spaces'/'Take Ticket'/'Pay Ticket'/'Leave'/'Quit' Take Ticket Your ticket is #1 What would you like to do? 'Show Spaces'/'Take Ticket'/'Pay Ticket'/'Leave'/'Quit' Pay Ticket What is your ticket #? '0' to quit 1 Your ticket # is 1 is that correct? Y/N y Your total is $15 Debit or Credit? Debit Thank you for your payment What is your ticket #? '0' to quit 0 
What would you like to do? 'Show Spaces'/'Take Ticket'/'Pay Ticket'/'Leave'/'Quit'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!