Home > Back-end >  Java help bosses
Java help bosses

Time:10-02

A, respectively defined as follows classes and interfaces: DivideClass, Graph, Triangle, Rectangle, Circle, Square, and IArea IPerimeter interface, specific requirements are as follows:

1, there are two members of the class DivideClass divide method:

1) define a return, the two type int data, division method to divide the

2) to define a return, the two float type data, division method to divide the

2, the type of Graph is defined in an abstract without ginseng draw method return value:

3, type of Triangle, inheritance Graph class

1) to achieve the Graph in the class draw method

2) define a ginseng draw method has no return value: output "draw a * * * * triangle graphics"

4, class a Rectangle, inheritance Graph class

1) to achieve the Graph in the class draw method

2) define a ginseng draw method has no return value: output "draw a rectangle * * * * graphics"

5, interface defined IArea an abstract no arguments double return value method getArea

6, the interfaces are defined IPerimeter an abstract no arguments double return value getPerimeter methods

7, class Circle, inheritance Graph, IArea and IPerimeter interface

1) defines a member variable radius, as the radius of the

2) method to construct

3) implement IArea getArea method in the interface of

4) IPerimeter interface interface to realize the method getArea

5) to achieve the Graph in the class draw method

8, Square, inheritance Graph, IArea and IPerimeter interface

1) defines a member variable length, as side

2) method to construct

3) implement IArea getArea method in the interface of

4) IPerimeter interface interface to realize the method getArea

5) to achieve the Graph in the class draw method

Two, for work related functional design menu, menu function is mainly to create objects, and using the object, the specific requirements:

When the input 11, create DivideClass instance of a class object, respectively test two overloaded divide method;

When the input 12, using the Graph type variable names, to reference Triangle and Rectangle class instance objects, and call them the draw method respectively;

13 when input, respectively using the keyboard input data, in order to create an instance of the object, Circle and Square solution of pupil, and output the data as well as the pupil;

When entering the quit, then quit

  • Related