Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

Question in Eclipse ??



Share on Google+Share on Google+

Question in Eclipse ??
0 Answer(s)      4 years and 9 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.

View Answers

Related Tutorials/Questions & Answers: