"""
Author : Jake Shugart

Date : 5/3/2024

Purpose : This module gets the current speed from the Car class

To write code that creates a Car object and then calls the accelerate method five times. 
After each call to the accelerate method, get the current speed of the car and display it. 
Then call the brake method five times. After each call to the brake method, get the current speed of the car 
and display it.
    
"""

#to import car class from class_car file
from Car import Car 

def main(): 
    
    try:
    
        year = int(input("Enter the car year : "))
        make = input("Enter the car model : ")
        myCar = Car(year,make) #to create the car object and assign make and year
    

        #Loop to call the accelerate method five times and display current speed
        for i in range(1,6,1):
            myCar.__accelerate__()
            print(f"The {year} {make}'s current speed is {myCar.__get_speed__()}")

        #Loop to call the brake method five times and display current speed
        for i in range(1,6,1):
            myCar.__brake__()
            print(f"The {year} {make}'s current speed is {myCar.__get_speed__()}")

    #error handling code block to account for Errors
    except Exception:
        print("ERROR! Please run the program again and input a valid entry ")
        
#call the main function 
main()
    


    

