Question
JAVA 1. A class called circle is designed as shown in the following class diagram. It contains: -Two private instance variables: radius (of type double)
JAVA
1.A class called circle is designed as shown in the following class diagram. It contains:
-Two private instance variables: radius (of type double) and color (of type String), with default value of 1.0 and "red", respectively.
-Two overloaded constructors;
-Two public methods: getRadius () and getArea ().
Write a test program called TestCircle which uses the Circle class and print the area of circle
2.Given an array of ints, return true if the array length is more than 1, and the first element and the last element are the same.
sameFirstLast ({1, 2, 3}) false s
sameFirstLast ({1, 2, 3, 1}) true
sameFirstLast ({1, 2, 1}) true
3.Set up an array to hold the following string values:
Reem (f)
Adnan (m)
Ali (m)
Sara (f)
Tareq (m)
Khaled (m)
Write a program to loop round and count how many are male and how many are female.
Circle radius : double = 1.0 -color: String = "red" +Circle() +Circle(radius: double) +getRadius():double +getArea() :doubleStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started