Q1: Write a Java class called Date which has: • 3 instance variables day, month and year • 2 constructors (a multi-argum

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
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

Post by answerhappygod »

Q1 Write A Java Class Called Date Which Has 3 Instance Variables Day Month And Year 2 Constructors A Multi Argum 1
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-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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply