1) Using the Object-Oriented Programming Paradigm,implement the necessary code in Python creating a ‘Car’ class with a constructor that stores all the Car information (ID, MAKE, MODEL, YEAR , COLOR, MILEAGE, PRICE_TO_DEALER, SALE_PRICE, PROFIT) as attributes.
2) Implement and add the following methods to the ‘Car' class in Question 1.
a) necessary getter methods
b) necessary setter methods
c) method to display all the information to the screen
d) a method to calculate the profit
The python code to implement car class is below
# creating class named car
class car:
PROFIT=0 # initilizing the profit
# using constructure to initilize the car object
def __init__(self,ID, MAKE, MODEL, YEAR , COLOR, MILEAGE,
PRICE_TO_DEALER, SALE_PRICE):
self.ID=ID
self.MAKE=MAKE
self.MODEL=MODEL
self.YEAR=YEAR
self.COLOR=COLOR
self.MILEAGE=MILEAGE
self.PRICE_TO_DEALER=PRICE_TO_DEALER
self.SALE_PRICE=SALE_PRICE
# declaring the necessary getters and setters method
# getter and setter of make
def set_make(self, MAKE):
self.MAKE = MAKE
def get_make(self):
return self.Make
# getter and setter of model
def set_model(self, MODEL):
self.MODEL = MODEL
def get_model(self):
return self.MODEL
# getter and setter of MILEAGE
def set_mileage(self, MILEAGE):
self.MILEAGE = MILEAGE
def get_mileage(self):
return self.MILEAGE
# getter and setter of PRICE_TO_DEALER
def set_pricetodealer(self, PRICE_TO_DEALER):
self.PRICE_TO_DEALER = PRICE_TO_DEALER
def get_pricetodealer(self):
return self.PRICE_TO_DEALER
# getter and setter of SALE_PRICE
def set_saleprice(self,SALE_PRICE):
self.SALE_PRICE=SALE_PRICE
def get_saleprice(self):
return self.SALE_PRICE
# function to calculate the PROFIT
def calculate_profit(self,SALE_PRICE,PRICE_TO_DEALER):
self.PROFIT=(SALE_PRICE-PRICE_TO_DEALER)
# function to return the calculate_profit
def get_profit(self):
self.calculate_profit(self.SALE_PRICE,self.PRICE_TO_DEALER)
return self.PROFIT
# function to display the car information
def display_car_info(self):
print('The ID of the car is: ',self.ID)
print('The Make of the car is: ',self.MAKE)
print('The MODEL of the car is: ',self.MODEL)
print('The YEAR of the car is: ',self.YEAR)
print('The COLOR of the car is: ',self.COLOR)
print('The MILEAGE of the car is: ',self.MILEAGE)
print('The PRICE_TO_DEALER of the car is:
',self.PRICE_TO_DEALER)
print('The SALE_PRICE of the car is: ',self.SALE_PRICE)
self.calculate_profit(self.SALE_PRICE,self.PRICE_TO_DEALER)
print('The PROFIT of the car is: ',self.PROFIT)
new_car=car(12,'skoda','superb',2005,'white',15,3000,3500)
print("Displaying CAR information after object initilization:\n
")
new_car.display_car_info()
print("\nChanging the MAKE to AUDI, SALE_PRICE to 10000 and PRICE_TO_DEALER to to 8000 :\n")
new_car.set_saleprice(10000)
new_car.set_pricetodealer(8000)
new_car.set_make('Audi')
new_car.display_car_info()
CODE SCREENSHOT



OUTPUT SCREEN

1) Using the Object-Oriented Programming Paradigm,implement the necessary code in Python creating a ‘Car’ class with...
I Need Help with this using Java Programming
:
Class name
fname
lname
Class variable
total Number
Constructor (no arguments)
Constructor (takes two arguments, fname and lname)
One getter method to return the fname and lname
One setter method for fname and lname
Inside Main:
Create three objects with the following
names
Jill Doe
John James
Jack Smith
When creating the first object (Should
not be an anonymous object)
use the argument-less constructor
Then use the setter method to assign...
Purpose: The main goal of this assignment is to practice Object Oriented Programming by creating classes, writing methods, and creating inheritance type relationships. Task: Create a Java project using the IDE Write a program using Object Oriented Programming Plan a program where two classes inherit from a single class and theme it in a way that makes sense. Create a super class with a non-constructor method Create two sub classes with their own non-constructor methods and have them inherit from...
1. Extending the answer from Python HW #7 for question #1, write
the following python code to expand on the Car class. Include the
python code you developed when answering HW #7.
Add class “getter” methods to return the values for model,
color, and MPG
Add class “setter” methods to change the existing values for
model, color, and MPG. The value to be used in the methods will be
passed as an input argument.
Add class method that will calculate...
BMI Class. Using JAVA write Object Oriented Programming by creating class, object and method , that takes users' input (weight and Height) and calculates the BMI. If the result is less than 18.5 display "you are underweight", if the result is greater than 18.5 display "you have a normal weight", if the result is greater than 24.9 display "your weight is considered overweight", and the result is greater than 30 display "your weight is considered as obese" (BMI = 703...
*Python* INTRODUCTION: The goal of this programming assignment is to enable the student to practice object-oriented programming using classes to create objects. PROBLEM DEFINITION: Write a class named Employee that holds the following data about an employee in attributes: name, IDnumber, department, jobTitle The class should have 8 methods as follows: For each attribute, there should be a method that takes a parameter to be assigned to the attribute. This is known as a mutator method. For each...
A) Please implement a Python script to define a student class with the following attributes (instance attributes): cwid: student’s CWID first_name : student’s first name last_name: student’s last name gender: student’s gender gpa: student’s gpa Please make these attributes as private ones so they have to be accessed via getter/setter methods or property. For this purpose, please define a getter/setter method and property for each of the attributes. Another thing you need to do is to define a constructor that...
SOLVE IN PYTHON: Exercise #1: Design and implement class Circle to represent a circle object. The class defines the following attributes (variables) and methods: A private variable of type double named radius to represent the radius. Set to 1. Constructor Methods: Python : An overloaded constructor method to create a default circle. C# & Java: Default Constructor with no arguments. C# & Java: Constructor method that creates a circle with user-specified radius. Method getRadius() that returns the radius. Method setRadius()...
This assignment involves writing a program that uses an abstract class and concrete subclasses. An abstract Vehicle class declares an abstract method named display() that is used to display vehicles. Vehicle has two subclasses: Boat and Car. A Boat has a length attribute, and a draft attribute (a draft is how far below the surface the bottom of the boat is). A Car has a make attribute and a year attribute. Appropriate getter, setter, and constructor methods should be defined...
1) Using the O-O Paradigm create a class in C++ for the object Dog 2) Implement ALL the behaviors (member functions/methods- including any needed constructors, and helper methods ) of the class. 3) Write the necessary Client/Application/User program The Client program should do the following: a) create at least 4 objects. b) show all the behaviors
In Python Programming: Write a class named Car that has the following data attributes: _ _year_model (for the car’s year model) _ _make (for the make of the car) _ _speed (for the car’s current speed) The Car class should have an _ _init_ _ method that accepts the car’s year model and make as arguments. These values should be assigned to the object’s _ _year_model and _ _make data attributes. It should also assign 0 to the _ _speed...