Homework #1
You should work by yourself on this assignment.
The 1992 Chevy Blazer: --------------------- 14.6 MPG city 27.3 MPG highway retail price is $18000.0 Special Features: * 8.0 ton capacity * 4 wheel drive * Monster truck tires * cup holderIn addition, you should create a RunAuto class containing a main method for testing your classes: create some Truck and Car objects and call their printAuto methods to print their information to stdout. The version of RunAuto.java that you turn in, should create 3 Truck and 3 Car objects and call the printAuto method of each object. You can use the same local variable for creating a Car or a Truck. For example:
// code inside main method Auto vehicle = new Car(< Car constructor args >); vehicle.printAuto(); vehicle = new Truck(< Truck constructor args >); vehicle.printAuto(); ...
Figure 1:
You should create a Birthday class with a constructor that
generates a valid random birthday. Note that for this problem the
year someone is born does not matter. You should also create a
RunBirthday class that executes the various experiments.
Make sure that your program's output is in tabular format (you can use the
tab character \t to ensure that entries in a column line-up).
Something like this:
Random random_date = new Random((new Date()).getTime());
You only need to do the above one time in your program; only create one Random object.
Once you have the Random object, you can then invoke one of its nextX
methods to get the next random number as an int or a float or...
# People # Experiments # Positive
-------- ------------- ----------
5 10 0
10 10 0
15 10 1
20 10 3
. . .
. . .
. . .