Private property: round radius r, the center coordinates x and y,
Methods: set and get all private property, r, x, y, the method of the method name since; Perimeter of method generating (); Calculation method of circular area area (),
Asked directly use the PI in the Math class,
(2) the design of a Cylinder type Cylinder, this class exists in mycylinder package, Cylinder inheritance Circle, it increases the following properties and methods:
Private property: height h,
Methods: the private attribute set and get h method, the method name since; Calculation method of surface area (); Method of volume calculation volume ()
(3) write a Java Application program Compute. Java, used to display a center of a cylinder coordinate position (as shown in figure 1 of the location of the k), height h, and its surface area (not including the area of the two bottom), volume and bottom area, circle radius r, center coordinates x and y, and highly h value from the command line, enter,
Tip and pay attention to:
The volume of a cylinder=base covers an area of * height;
The cylinder of high surface area=* bottom circumference;
Every moment is the generation of a cylinder, on the basis of the original circle, adding highly generated,
(4) test Compute. Java program, processing all exceptions that may occur in the program, figure 1
And have corresponding message, such as command line no input, the program will be output to the console "command line no input, please enter the correct numerical" such a message,
The correct input output as shown in figure 2,
CodePudding user response:
Do your ownCodePudding user response:
This kind of code, just 200 points can not enough oh,,, have to payCodePudding user response:
Examination questions? You still do your own, hate the most academic fraudCodePudding user response:
CodePudding user response:
Problem solvedCodePudding user response:
This is very simple, do you have a look at the foundation can write. If you want to down the road of apes in a program, must hold to write their own.