Question: (a) (b) (c) Write a class called circle that contains: (i) (ii) (iii) (iv) (v) Two private instance variables: radius (of type double) and
(a) (b) (c) Write a class called circle that contains: (i) (ii) (iii) (iv) (v) Two private instance variables: radius (of type double) and color (of type String), with default value of 1.0 and "red", respectively. (2 marks) Two overloaded constructors; Set both radius and color to default for first constructor. Use given radius and default color for second constructor. Two public methods: getRadius () and get Area (). Write the main () function for the circle class above. Draw a detail UML class diagram for circle class. (4 marks) (4 marks) (6 marks) (3 marks) Describe why main () function must be public, static and void. (3 marks) State the three pillars of object-oriented programming. (3 marks) (a) (b) (c) Write a class called circle that contains: (i) (ii) (iii) (iv) (v) Two private instance variables: radius (of type double) and color (of type String), with default value of 1.0 and "red", respectively. (2 marks) Two overloaded constructors; Set both radius and color to default for first constructor. Use given radius and default color for second constructor. Two public methods: getRadius () and get Area (). Write the main () function for the circle class above. Draw a detail UML class diagram for circle class. (4 marks) (4 marks) (6 marks) (3 marks) Describe why main () function must be public, static and void. (3 marks) State the three pillars of object-oriented programming. (3 marks)
Step by Step Solution
3.46 Rating (149 Votes )
There are 3 Steps involved in it
Answer a Circle Class Implementation public class Circle i Private instance variables private double radius private String color ii Two overloaded con... View full answer
Get step-by-step solutions from verified subject matter experts
