- Q1 Write A Java Class Called Date Which Has 3 Instance Variables Day Month And Year 2 Constructors A Multi Argum 1 (58.38 KiB) Viewed 96 times
Q1: Write a Java class called Date which has: • 3 instance variables day, month and year • 2 constructors (a multi-argum
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q1: Write a Java class called Date which has: • 3 instance variables day, month and year • 2 constructors (a multi-argum
Q1: Write a Java class called Date which has: • 3 instance variables day, month and year • 2 constructors (a multi-argument constructor and a zero-argument one) • getters and setters for the three instance variables .toString() method Q2: Write a Java class called WashingMachine which: • is a subclass from Machine class (refer to Meetings 3&4 Exercises) • has 2 new instance variables productionDate and capacity • has 2 constructors (a multi-argument constructor and a zero-argument one) • has getters and setters for the new instance variables • has toString() method which calls the toString() of the super class • has equals() method (check equality of all attributes except power) • has compareTo() method to be used in sorting (according to brandName then capacity) Q3: Write a Java class called Test WashingMachines which has a main method to test your code as follows: • create a WashingMachine object called wm using the mutli-arg constructor • print the status of wm • declare and create an ArrayList of washing machines • fill the list with suitable data . check if wm is in the list • sort the list and print it after sorting Q4: Draw a simple class diagram showing only relationships between the classes.