Consider a project having Test class and main method (Note: Only Test class and main method): a) Create an ArrayList “te
Posted: Wed Apr 27, 2022 3:44 pm
Consider a project having Test class and main method (Note: Only
Test class and main method): a) Create an ArrayList “temperatures”
of type double to represent temperature readings. b) Add the
following numbers to the ArrayList: {35.5, 26.1, 22.3, 31.4, 32.3,
24.1, 25.9}. c) Print the readings where temperature is more than
30.0 from the ArrayList. d) Find and replace each temperature less
than 25.0 with the temperature 25.0. Example: 24.1 →25.0 e) Print
all the readings of ArrayList “temperatures” after modification.
Question 2 (10 Marks): CLO1, 2, 3, 5 Consider this project has 4
classes (including Test Class) as the following: A. Create class
Property. B. Create class Flat that inherits from the class
Property. C. Create class Villa that inherits from the class
Property. D. In the Test class (in main method), create an
ArrayList of the Property objects and name it listOfProperties. E.
In the Test class (in main method), assume your own objects and add
them to the ArrayList listOfProperties. One Object of Property, Two
Objects of Flat, Three Objects of Villa. F. In the Test class (in a
new method), create a method “getCheapestProperty” that: 1.
Receives ArrayList of type Property. 2. Returns the location of the
object that has the lowest price in the ArrayList. G. In the Test
class (in a new method), create a method “printVillasWithSwimPool”
that: 1. Receives ArrayList of type Property. 2. Prints details of
the Villa objects in the ArrayList, that have swimming pool. So,
hasSwimmingPool is True. H. In the Test class (in main method),
test methods created in step F and G.
solve it asap java
Test class and main method): a) Create an ArrayList “temperatures”
of type double to represent temperature readings. b) Add the
following numbers to the ArrayList: {35.5, 26.1, 22.3, 31.4, 32.3,
24.1, 25.9}. c) Print the readings where temperature is more than
30.0 from the ArrayList. d) Find and replace each temperature less
than 25.0 with the temperature 25.0. Example: 24.1 →25.0 e) Print
all the readings of ArrayList “temperatures” after modification.
Question 2 (10 Marks): CLO1, 2, 3, 5 Consider this project has 4
classes (including Test Class) as the following: A. Create class
Property. B. Create class Flat that inherits from the class
Property. C. Create class Villa that inherits from the class
Property. D. In the Test class (in main method), create an
ArrayList of the Property objects and name it listOfProperties. E.
In the Test class (in main method), assume your own objects and add
them to the ArrayList listOfProperties. One Object of Property, Two
Objects of Flat, Three Objects of Villa. F. In the Test class (in a
new method), create a method “getCheapestProperty” that: 1.
Receives ArrayList of type Property. 2. Returns the location of the
object that has the lowest price in the ArrayList. G. In the Test
class (in a new method), create a method “printVillasWithSwimPool”
that: 1. Receives ArrayList of type Property. 2. Prints details of
the Villa objects in the ArrayList, that have swimming pool. So,
hasSwimmingPool is True. H. In the Test class (in main method),
test methods created in step F and G.
solve it asap java