Changes

Jump to: navigation, search

OPS435 Python Lab 7

1,169 bytes added, 11:12, 3 December 2017
INVESTIGATION 1: Classes and objects
The exact definition of the type and what you would expect to store in objects of that type is up to you - the programmer. You want to design your classes so that you can manage data in your application as easily as possible.
Note that inside Notes about the mechanics of implementing classes:* Inside a program typically a class name starts with a capital letter and object names, as typical variable names, start with a lowercase letter.* Just as you can define a function in a separate file from where you use it - you can define a class in a separate file. In fact it's even more common with classes since you're more likely to need to use them in multiple places. For this investigation create the classes and objects from the table above. No test script is provided for this section because the design of the classes is left up to you. Store the data that you think might be relevant for that type. Implement at least two methods in each class (the constructor plus one other). As you try to design the classes you will quickly realise that there is a potentially infinite number of properties (components) and methods that any class can have. What you choose to include in your class definition should be guided by what you intend to do with it. For example if the tire tread depth in the cars is important in your application - you should include it in your Car class. But if you don't care about when the last oil change was or you don't have the means of obtaining that information - there's no point in adding that to the description of the Car class.
= LAB 7 SIGN-OFF (SHOW INSTRUCTOR) =

Navigation menu