Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please this question must be done with python Q1. create a parking garage with Python Object-Oriented Programming Your parking gargage class should have the following

please this question must be done with python

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

What is linear transformation? Define with example

Answered: 1 week ago

Question

3. What might you have done differently

Answered: 1 week ago

Question

4. Did you rethink your decision?

Answered: 1 week ago