I have this py program and I need assistance using it. I am using Visual Studio and I need to know how to:
Here is the code:
import uuid
from datetime import datetime
class automobile:
# setting up the constructor with default aruguments
# default argument can be removed, the all the parameter
# should be passed with constructor invocation.
def __init__(self, make="", model="", color="", year=0, mileage=0):
self.__id = uuid.uuid1().hex
self.__make = make
self.__model = model
self.__color = color
self.__year = year
self.__mileage = mileage
self.__createdate = datetime.now().strftime("%d-%m-%y %H:%M:%S")
def add_vehicle(self, inventoryObj):
inventoryObj.append(self)
def remove_vehicle(self, inventoryObj):
inventoryObj.remove(self)
def set_make(self, make):
self.__make = make
def set_model(self, model):
self.__model = model
def set_color(self, color):
self.__color = color
def set_year(self, year):
self.__year = year
def set_mileage(self, mileage):
self.__mileage = mileage
def __str__(self):
return '{}, {}, {}, {}, {}, {}, {}'.format(self.__id, self.__make, self.__model, self.__color, self.__year, self.__mileage, self.__createdate)
# creating an empty list to store vehicle content
myVehicleList = []
# creating a vehicle object and printing the same
tom_car = automobile("Toyota", "Fortuner", "White", 2014, 10)
print tom_car
# creating an empty object and adding details using the set functions
bob_car = automobile()
bob_car.set_make("Mercedes")
bob_car.set_model("4matic")
bob_car.set_color("black")
bob_car.set_year(2019)
bob_car.set_mileage(8)
print bob_car
# adding the created objects to the list
tom_car.add_vehicle(myVehicleList)
bob_car.add_vehicle(myVehicleList)
# printing the list elements
print myVehicleList[0]
print myVehicleList[1]
I have this py program and I need assistance using it. I am using Visual Studio...
I have to write a program where the program prints a deck of
cards. instead of having your regular suits and numbers the program
will use a value for a number, id will be either rock, paper, or
scissors, and the coin will be heads or tails. print example: 2 of
rock heads. If the user is enters 1 the program will print out 30
of the print example and arrange them by there values. if the user
enters 2...
9p
This is for Python I need help.
Pet #pet.py mName mAge class Pet: + __init__(name, age) + getName + getAge0 def init (self, name, age): self.mName = name self.mAge = age Dog Cat def getName(self): return self.mName mSize mColor + __init__(name, age,size) + getSize() + momCommento + getDog Years() +_init__(name, age,color) + getColor + pretty Factor + getCatYears def getAge(self): return self.mAge #dog.py import pet #cat.py import pet class Dog (pet. Pet): class Cat (pet. Pet): def init (self,...
I need this in java please Create an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present in your automobile class: private string make private string model private string color private int year private int mileage. Your program should have appropriate methods such as: default constructor parameterized constructor add a new vehicle method list vehicle information (return string array) remove a vehicle method update vehicle attributes method. All methods...
I NEED A CORRECT ANSWER THIS TIME PLEASE.THIS IS MY fourth TIME POSTING THIS QUESTION (Inheritance) Please write a general class named Vehicle which contains make, model, color, year, mileage, weight and type information. Using the inheritance please write another class for gas vehicle (GasVehicle) and electric vehicles (ElectricVehicle). The GasVehicle class has an attribute named fuel tank capacity. However, the ElectricVehicle class has an energy storage in kwh. All the above classes must contains a method named print_vehicle_info which...
Use of search structures! how can i make this program in python? Learning Objectives: You should consider and program an example of using search structures where you will evaluate search trees against hash tables. Given the three text files under containing the following: - A list of students (classes Student in the distributed code) - A list of marks obtained by the students (classes Exam results in the distributed code) - A list of topics (classes Subject in the distributed...
For my computer class I have to create a program that deals with
making and searching tweets. I am done with the program but keep
getting the error below when I try the first option in the shell.
Can someone please explain this error and show me how to fix it in
my code below? Thanks!
twitter.py - C:/Users/Owner/AppData/Local/Programs/Python/Python38/twitter.py (3.8.3) File Edit Format Run Options Window Help import pickle as pk from Tweet import Tweet import os def show menu():...
Please Help. C++. Need 3 attributes and 3 methods added to the code below. Need the prototype added to the .h file......and the implementation in the .cpp file....thanks! edited: I just need the above and then I was told to use the methods in the main program; for the vehicle. Any 3 attributes and any three methofds. source.cpp file // Header Comment #include #include #include #include "Automobile.h" using namespace std; struct Address{ string street; string city; string state; string zip;...
THIS IS WHAT I HAVE I NEED TO FIX IT SO:
hours_worked should not be inputed separately.
Get the hours as 40 40 40 40 or 40, 40, 40, 40 whichever
separator suits you.
How do I do this?
How would you change what I have in to it getting into that kind
of input.
Thank you!
class Employee:
again = 'y'
def __init__(self):
self.__rate = 7.25
self.__totalhour = 0
self.__regularpay = 0
self.__overtimepay = 0
self.__totalpay = 0
self.__tax...
Please write below code in C++ using Visual
Studio.
Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) • Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 • Hint: Use vectors and vector functions to store the set of items 2. Get the number of items in the...
12p
I need help this is Python
EXCEPTIONS: It's easier to ask forgiveness than permission. Try the code and catch the errors. The other paradigm is 'Look before you leap' which means test conditions to avoid errors. This can cause race conditions. 1.Write the output of the code here: class MyError(Exception): pass def notZero(num): if num == 0: raise MyError def run(f): try: exec(f) except TypeError: print("Wrong type, Programmer error") except ValueError: print("We value only integers.") except Zero Division Error:...