r/pythonhelp • • Feb 02 '21

HOMEWORK Need guidance in using python classes.

Hello,

before I begin I just wanted to say that I am brand new to any type of programming So thank you in advance for your patience and help.

I am currently working on a school assignment utilizing python classes to:

1.) Create a Vehicle class with the following attributes and functions:

Attributes: make, model, color, fuelType, options (which will be defined as a python list chosen by the user when presented with a menu of programmer chosen vehicle options that can apply to both cars and pickup trucks

Options: power mirrors, power locks, power windows, remote start, backup camera, bluetooth, cruise control, GPS

functions: getMake(), getModel(), getColor(), getFuelType(), getOptions().

2.) Create a Car class as a child of the Vehicle class with the following attributes and functions:

Attributes: engineSize, numDoors

Functions: getEngineSize(), getNumdoors()

3.) Create a Pickup class as a child of the Vehicle class with the attributes and functions :

Attributes: cabStyle, bedLength

Functions: getCabstyle(), getBedLength()

4.) Your program will prompt the user to create at least one object of each type (Carand Pickup) allowing the user to define the attributes of the vehicles in their garage.

5.) Using a menu system and capturing user input your program will allow the user the choice of adding a car or pickup truck and define the vehicle's attributes. 

6.)

The user will choose from a list of options to add to the vehicle's options list and must choose a minimum of one vehicle option per vehicle. 

7.) Your program must allow the user to have multiple vehicles in their virtual garage and must have at least one Car and one Pickup.

8.) When the user is finished adding vehicles to their virtual garage the program will output the vehicles in their garage and their attributes.

whew, what a list! Alas, I am lost in the woods on this one as I'm not quite sure where to begin with the user inputs, and I don't really know what the requirements are asking for within the functions. All I have done so far is code the classes (See screenshot) should I begin with creating a class method for the inputs?

Again I appreciate any advice on how I should move forward with the rest of the requirements.

2 Upvotes

7 comments sorted by

View all comments

1

u/Onyxus_music Feb 06 '21

Hello,

Sorry to jump in your post, but this is EXACTLY what I'm trying to do (I'm also completely new to coding), but I'm having some issues trying to figure out how to get the user's input to add a vehicle to his garage. I would love to work with you in trying to figure this out, if you don't mind. If you would like to, message me, please? This assignment is due by Sunday and I've been spending my week trying to figure it out. :(

1

u/Few_North5726 Feb 13 '21

You wouldn't happen to be in Fadi's class, would you?

1

u/[deleted] Feb 14 '21

I am! This assignment has come up out of nowhere it seems like. I am working on it myself and I am having lots of issues. I feel like we learned all about user inputs, classes, etc. throughout the book, but did not get any instruction on how to pass user input into classes. Throughout the textbook we called all the functions in the initial code, not from user input. Also, I do not recall learning about menu options unless I missed something the last few weeks. How are you coming along in this assignment?