Computer Science, asked by jugantaphukan, 9 months ago

Write a program in PYTHON to calculate the parking charges of a vehicle. Enter the type of vehicle as a character (like c for car, b for bus, etc.) and read the hours and minutes when the vehicle enters the parking lot. When the vehicle is leaving, enters its leaving time. Calculate the difference between the two timings to calculate the number of hours and minutes for which the vehicle was parked. Calculate the charges based on the following information: Vehicle Name Rate till 3 hours Rate after 3 hours Truck / bus Rs 20 30 Car Rs 10 20 Scooter /cycle/ Motor cycle Rs 5 10

Answers

Answered by aydivirs
3

Answer:

sorry don't know

Explanation:

Answered by dreamrob
8

Program :

def diff(h1 , m1 , h2 , m2):

   if(m1 > m2):

       m2 +=60

       --h2

   m = m2 - m1

   h = h2 - h1

   print("Time for which vehicle was in parking = " , h , " : " , m)

   return h

   

vehicle = input("Enter 'c' for car, 'b' for bus/truk and 's' for scooter/cycle/motor cycle: ")

h_entry = int(input("Enter at what hour vehicle has entered : "))

m_entry = int(input("Enter at what minute vehicle has entered : "))

h_exit = int(input("Enter at what hour vehicle has exit : "))

m_exit = int(input("Enter at what minute vehicle has exit : "))

if(vehicle == 'b'):

   if(diff(h_entry,m_entry,h_exit,m_exit)<=3):

       print("Charge : ",20)

   else:

       print("Charge : ",30)

elif(vehicle == 'c'):

   if(diff(h_entry,m_entry,h_exit,m_exit)<=3):

       print("Charge : ",10)

   else:

       print("Charge : ",20)

elif(vehicle == 's'):

   if(diff(h_entry,m_entry,h_exit,m_exit)<=3):

       print("Charge : ",5)

   else:

       print("Charge : ",10)

else:

   print("Invalid vehicle choice")

Similar questions