1. Identify three objects that might belong to each of the following classes:
a. Automobile
b. NovelAuthor
c. CollegeCourse
The students will have a variety of answers for these questions. Some examples might be:
a. myRedChevroletCamaro, theBlackfordMustangWithTheDentThatBobDrives, thePorschee911ThatDonaldTrumpOwns
b. Terry Brooks, Steven King, Ray Bradbury
c. English Composition, Calculus, Physics
2. Identify three different classes that might contain each of these objects:
a. Wolfgang Amadeus Mozart
b. My pet cat named Socks
c. Apartment 14 at 101 Main Street
The answers to this question will also vary. Some examples are:
a. musicians, composers, baroque music performer
b. animals, domestic pets, felines
d. building, housing, locations
3. Design a class named CustomerRecord that holds a customer number, name, and address. Include methods to set the values for each data field and print the values for each data field. Create the class diagram and write the pseudocode that defines the class.
class CustomerRecord private num CustomerNumber private char Name private char Address
public setCustomerNumber (num Number) CustomerNumber = Number return public setName (char newName) Name=newName return public setAddress (char newAddress) Address=newAddress return 4. Design a class named House that holds the street address, price, number of bedrooms, and number of baths in a House. Include methods to set the values for each data field. In the set methods, do not allow the price, bedrooms, or baths to be negative. Include a method that displays all the values for a House. Create the class diagram and write the pseudocode that defines the class.
class House private char Address private num Price private num Bedrooms private num Baths
public SetAddress(char newAddress) Address=newAddress return public SetPrice(num newPrice) if newPrice>0 then