Create a class called Car (Car.java). It should have the following private data members: String make String mode lint year Provide the following methods: default constructor (set make and model to an empty string, and set year to 0) non-default constructor Car(String make, String model, int year) getters and setters for the three data members method print() prints the Car object’s information, formatted as follows: Make: Toyota Model: 4Runner Year: 2010 public class Car { } Complete the following unit test for the class Car described above. Make sure to test each public constructor and each public method, print the expected and actual results. // Start of the unit test of class Car public class CarTester { public static void main(){ // Your source codes are placed here return; } }
Create a class called Car (Car.java). It should have the following private data members:
String make
String mode
lint year
Provide the following methods:
default constructor (set make and model to an empty string, and set year to 0)
non-default constructor Car(String make, String model, int year)
getters and setters for the three data members
method print() prints the Car object’s information, formatted as follows:
Make: Toyota
Model: 4Runner
Year: 2010
public class Car {
}
Complete the following unit test for the class Car described above. Make sure to test each public constructor and each public method, print the expected and actual results.
// Start of the unit test of class Car
public class CarTester {
public static void main(){
// Your source codes are placed here
return;
}
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images