Monday, October 19, 2009

Pg. 340 Exercise 5

public class Car5{
private String make;
private int year;
private String color;

public Car5(){
}//end default constructor

public Car5(String m, int y, String c){
this.make = m;
this.year = y;
this.color = c;
}//end constructor

public boolean copyTo(Car5 newCar){
if(newCar.make == this.make && newCar.year == this.year && newCar.color == this.color){
return false;
}else{
return true;
}//end of if else statement
}//end of copyTo method
}//end of Car5

Pg. 292 Exercise 12

10
20
30
60
50

Pg. 287 Exercise 4

public class Computer{
private String hardDrive;

public void SwapHardDrive(Computer otherComputer){
String temp;
temp = otherComputer.hardDrive;
otherComputer.hardDrive = this.hardDrive;
this.hardDrive = temp;
}//end of SwapHardDrive method
}//end of Computer class