Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Question in Eclipse ??
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


noor
Question in Eclipse ??
0 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners


** Hello EveryOne , L Have Question in Eclipse ?!!

Question is : A.( The square class) Design a class named Square that contains :

1.A private instance variable side of type double

2.A no-argument constructor that sets the side to 1.0 by calling a method named setSide that you will declare.

3.A method setSide . Set the side variable to the argument of the method. Also make sure that the side is not less than 0.0. If it is, keep the default setting of 1.0.

4.A method getSide for that retrieves the value of instance variable side.

5.Add another constructor that takes one argument, the side, and uses the Squareâ??s set method to set the side.

6.A method computeArea that computes the area of a Square.

7.A toString method that will return a String containing the value of side and the area of the Square.

B.(The SquareTest class ) Design another class to test the Square class. Ensure that all your methods and constructors work properly.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com