Computers and Technology

In this part of the assignment we will practice using a class that has been given to us. You are provided with a file car. py (see attached file later). This file contains code that implements a very basic car object. It has a constructor, getter and setter methods. Take a look at the Car class and familiarize yourself with those methods. Your task is to write the main routine that creates a Car object, prints the initial state of the object, speeds the car up until you reach a speed of 50 miles per hour, then slows it down until the speed is zero. Here are some additional specifications: The user of the program must provide the car's make and year model. The year is an integer value and cannot be less than 1945 or greater than 2020. You must use loops and try/except for the year validation. You must properly use loops and conditional statements when needed. You are not allowed to modify the car. py file or the Car class. Make sure you include a header comment at the top of your file. Below there’s a sample run:
Enter the car's make: Audi
Enter the car's year model: 1900
Invalid year. Try again. Enter the car's year model: abc
Invalid input: a numeric value was expected. Try again. Enter the car's year model: 2022
Invalid year. Try again. Enter the car's year model: 2020
My car's make: Audi
My car's year: 2020
My car's current speed: 0 mph.
Accelerating
My car's current speed: 5 mph.
My car's current speed: 10 mph.
My car's current speed: 15 mph.
My car's current speed: 20 mph.
My car's current speed: 25 mph.
My car's current speed: 30 mph.
My car's current speed: 35 mph.
My car's current speed: 40 mph.
My car's current speed: 45 mph.
My car's current speed: 50 mph.
Slowing down
My car's current speed: 45 mph.
My car's current speed: 40 mph.
My car's current speed: 35 mph.
My car's current speed: 30 mph.
My car's current speed: 25 mph.
My car's current speed: 20 mph.
My car's current speed: 15 mph.
My car's current speed: 10 mph.
My car's current speed: 5 mph.
My car's current speed: 0 mph.
Notes: You may find the following site useful to compare your output against the expected program output: Diffchecker The purpose of this problem is to practice using classes and modules. Please make sure to submit a well-written program. Good identifier names, useful comments, and spacing will be some of the criteria that will be used when grading this assignment. This assignment can be and must be solved using only the materials that have been discussed in class. Do not look for alternative methods that have not been covered as part of this course.
Use if __name__ == "__main__": in code please
car. py (FILE)
# File Name: car. py
# Purpose: A basic class to represent a car
# Date: January 11, 2021
class Car:
# constructor
def __init__ (self, make, year):
self.__make = make
self.__year = year
self.__speed = 0
# getters
def getMake(self):
return self.__make def
getYear(self):
return self.__year
def getSpeed(self):
return self.__speed
# setters
def accelerate(self):
self.__speed = self.__speed + 5
def brake(self):
self.__speed = self.__speed - 5

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:00, alowery89
Match the steps of the process to julia's analysis. 1. analyze choices. current costs for making phone calls to foreign countries averages between five and ten cents a minute. 2. determine the goals. julia needs to reduce the cost of telecommunications without reducing her employees' ability to do their jobs. 3. gather data. the corporate computer network will be able to handle the increased traffic that will occur as a result of voip. 4. evaluate the decision. julia will have her it department set up voip in the smallest domestic office. 5. make the decision. julia will have employees document the benefits and problems that result from using the new technology.
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, HarryPotter10
Open this link after reading about ana's situation. complete each sentence using the drop-downs. ana would need a minimum of ato work as a translator. according to job outlook information, the number of jobs for translators willin the future.
Answers: 3
image
Computers and Technology, 23.06.2019 15:20, headshotplayzcod
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, arturocarmena10
The initial tableau of a linear programming problem is given. use the simplex method to solve it. x 1 x 2 x 3 s 1 s 2 z 1 2 4 1 0 0 8 3 4 1 0 1 0 10 minus3 minus12 1 0 0 1 0 the maximum is nothing when x 1equals nothing, x 2equals nothing, x 3equals nothing, s 1equals3, and s 2equals0. (be sure to simplify to lowest terms if necessary.)
Answers: 2
Do you know the correct answer?
In this part of the assignment we will practice using a class that has been given to us. You are pro...

Questions in other subjects:

Konu
English, 20.10.2020 04:01
Konu
Mathematics, 20.10.2020 04:01
Konu
Biology, 20.10.2020 04:01