- B Given The Following Clock And Arraylist Adts Public Class Clock Private String Brand Private String Shape 1 (72.31 KiB) Viewed 35 times
b) Given the following Clock and ArrayList ADTS: public class Clock { } private String brand; // private String shape; /
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
b) Given the following Clock and ArrayList ADTS: public class Clock { } private String brand; // private String shape; /
b) Given the following Clock and ArrayList ADTS: public class Clock { } private String brand; // private String shape; //round, square private double price; //normal constructor //Accessor methods:getShape (), getPrice (), getDesign (), getType() //printer method: toString() private String design; //antique, modern private char type; //D: digital, A: analog public class ArrayList { public ArrayList() {...} public void add (Clock data) {...} public int size () {...} public clock get (int index) {...} } //definition of other methods Assume that 15 objects of Clock have been inserted into an array list named clockAL. Write program fragment for each of the following: i) Count and display the number of digital round shape clock in clockAL (3.5 marks) ii) Calculate and display the total price of analog clock in clockAL which price is more than RM150 (3.5 marks)