Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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() :double

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions