Sorry I'm out today guys...I've been feeling lousy all week, and I really need to rest up.
Computer Science 2 guys
Continue to work on the book problems and the lab assignment. The book assignment must be completed and emailed to me by 3:30 today...the lab is of course due next Tuesday.
AP Guys - I think it's time you practiced making parent and child classes...
You are to create a new project called "MyOwnAutoShopProject" as following:
* Create a super class called Car. The Car class has the following fields and methods.
o int speed;
o double regularPrice;
o String color;
o double getSalePrice();
* Create a subclass of Car class and name it as Truck. The Truck class has the following fields and methods.
o int weight;
o double getSalePrice(); // If weight > 2000, 10% discount. Otherwise, 20% discount.
* Create a subclass of Car class and name it as Ford. The Ford class has the following fields and methods
o int year;
o int manufacturerDiscount;
o double getSalePrice(); // From the sale price computed from Car class, subtract the manufacturerDiscount.
* Create a subclass of Car class and name it as Sedan. The Sedan class has the following fields and methods.
o int length;
o double getSalePrice(); // If length > 20 feet, 5% discount, Otherwise, 10% discount.
* Create MyOwnAutoShop class which contains the main() method. Perform the following within the main() method.
o Create an instance of Sedan class and initialize all the fields with appropriate values. Use super(...) method in the constructor for initializing the fields of the super class.
o Create two instances of the Ford class and initialize all the fields with appropriate values. Use super(...) method in the constructor for initializing the fields of the super class.
o Create an instance of Car class and and initialize all the fields with appropriate values.
* Display the sale prices of all instances created. You may use toString() methods to do this, or use the main, whatever you think is best.
This will be due at the end of class Monday, 2/1.
Thursday, January 28, 2010
Tuesday, January 26, 2010
Welcome new Computer Science students!
The slides for today are in the "Computer Science 2" section on the sidebars to the right. Search for "Ch 1 slides" to find them.
Subscribe to:
Posts (Atom)