
Code:
import tkinter
class Car:
def __init__(self,color,company,model,price,type):
self.color=color
self.company=company
self.model=model
self.price=price
self.type=type
def display_car_setails(self):
return "A "+self.color+" "+self.company+" car of model "+self.model+". The type of the car is "+self.type+" with price: "+self.price
all_cars=[]
row_number=0
car1=Car("red","BMW","1431","13,00,000","classic")
all_cars.append(car1)
car2=Car("yellow","Audi","14r441","123,00,000","Mountain")
all_cars.append(car2)
car3=Car("blue","Ford","14d2131","19,00,000","VIP")
all_cars.append(car3)
car4=Car("green","Ferrari","3451","243,00,000","Race")
all_cars.append(car4)
def main(all_cars,row_number):
win=tkinter.Tk()
tkinter.Label(win,text="List of cars!").grid(row=row_number)
row_number+=1
if len(all_cars)!=0:
for i in range(len(all_cars)):
tkinter.Label(win,text=all_cars[i].display_car_setails()).grid(row=row_number)
row_number+=1
else:
tkinter.Label(win,text="None").grid(row_number)
row_number+=1
win.mainloop()
main(all_cars,row_number)
The above code is a python program contains a Car class. We can add more cars and add in all_cars list. Programs displays all cars in a python GUI.
Pre step to run the program:
Install tkinter in the computer. To install tkinter, run the following command in cmd or terminal.
pip install Tkinter
write a source code anything related to cars. code need to be interesting and code needs...
Hello Sir/Madam, could you please help me for the code to write UNO CARD GAME using following elements using JAVA Language: 1. Use of at least three Abstract Data Types 2. Use of inheritance and polymorphism 3. Use of recursion 4. Connection and use of a simple database 5. At least one sorting algorithm 6. At least one search algorithm 7. Use of a graphical user interface. Thank you in advance!
Question 11 The feature that enables you to split source code between two or more files is: Select one: a. base class b. partial classes c. generics d. dynamic link library e. package Question 12 Packaging data attributes and behaviors into a single unit so that the implementation details can be hidden describes an object-oriented feature called: Select one: a. abstraction b. objects c. inheritance d. polymorphism e. encapsulation Question 13 A multitier application would probably have:...
please write the code in
C++
2 Base class File 3 Derived class PDF 3.1 Class declaration • The class PDF inherits from File and is a non-abstract class 1. Hence objects of the class PDF can be instantiated. 2. To do so, we must override the pure virtual function clone) in the base class • The class declaration is given below. • The complete class declaration is given below, copy and paste it into your file. . It is...
Y. Daniel Liang’s 8 Class Design Guidelines were posted on the File Manager and handed out in class. Please choose 5 guidelines and discuss them in depth. For each guideline, use 1 page or more for your discussion. You can use the code provided in class to demonstrate your points. The code should not be more than one-third of your writing. 1. Cohesion • [✓] A class should describe a single entity, and all the class operations should logically fit...
Part 1: Use principles of inheritance to write code calculating the area, surface area, and volume of rectangular objects. First, write an abstract super class RectangularShape, then write a subclass Rectangle that inherits from the super class to compute areas of rectangles, including squares if there is only one data. Finally, write another subclass Cuboid that inherits from its super class Rectangle above to compute surface areas and volumes of cuboids, including 3 equal sided cube. Must apply code-reusability in...
I need some help i need to do this in C# Objectives: • Create an application that uses a dictionary collection to store information about an object. • Understanding of abstract classes and how to use them • Utilize override with an abstract class • Understanding of Interfaces and how to use them • Implement an Interface to create a “contract” between classes. • Compare and contrast inheritance and interfaces. Instructions: Interface: Create an interface called ITrainable which contains the...
Section 0 Problem Background A local entrepreneur has investments in property and vehicles. Recently business has boomed and she needs object-oriented software to keep track of her current and past assets. As an OOP expert, you are tasked to write a program that keeps track of these assets. You are recommended to read through the requirements of all sections before attempting any coding. Section 1: Basic Classes • A House class with instance variables erfNumber, location, noOfRooms, etc. • Mandatory...
The purpose of this is to use inheritance, polymorphism, object
comparison, sorting, reading binary files, and writing binary
files. In this application you will modify a previous project. The
previous project created a hierarchy of classes modeling a company
that produces and sells parts. Some of the parts were purchased and
resold. These were modeled by the PurchasedPart class. Some of the
parts were manufactured and sold. These were modeled by the
ManufacturedPart class. In this you will add a...
Inventory ManagementObjectives:Use inheritance to create base and child classesUtilize multiple classes in the same programPerform standard input validationImplement a solution that uses polymorphismProblem:A small electronics company has hired you to write an application to manage their inventory. The company requested a role-based access control (RBAC) to increase the security around using the new application. The company also requested that the application menu must be flexible enough to allow adding new menu items to the menu with minimal changes. This includes...
*** FOR A BEGINNER LEVEL JAVA CLASS, PLEASE KEEP CODE SIMPLE, AND WE USE BLUE J IN CLASS (IF IT DOESNT MATTER PLEASE COMMENT TELLING WHICH PROGRAM YOU USED TO WRITE THE CODE, PREFERRED IS BLUE J!!)*** ArrayList of Objects and Input File Use BlueJ to write a program that reads a sequence of data for several car objects from an input file. It stores the data in an ArrayList<Car> list . Program should work for input file containing info...