Description
Question 1: The Area and Perimeter of a circle [15 points]
Please write a program to calculate the area and perimeter of a circle according to the radius, which is an argument (args[0]) passing by command line.
The output will be two rows, and for each row, those are the area and perimeter respectively. Please make sure that the double value in each row should keep two decimals.
Sample output when argument is: 3
Question 2: The maximum, minimum and the Average number [15 points]
Suppose your program will pass four integer numbers from command line. Please write a program to find the maximum, minimum and the average value of those.
The output will be three rows, and for each row, those are the maximum, minimum and the average value. Please make sure that the average value should keep two decimals.
Sample output when arguments are: 2 1 3 4
Question 3: Area Calculation of Regular Polygons [15 points]
Please calculation the area of regular polygons including triangle, quadrangle, pentagon and hexagon. The length of the side of those polygons would be passed by command line, which means the length of the side equals to the double value of args[0].
The output will be four rows, and for each row, those are the area of triangle, quadrangle, pentagon and hexagon respectively. Please make sure that the double value of each area should keep two decimals.
Sample output when argument is: 2
Question 4: Whether a point is in a circle [15 points]
Please writhe a program to judge whether a point is in a circle. Suppose we need to pass five double arguments from command line.
The first two arguments (args[0] and args[1]) represent the center (args[0], args[1]) of the circle, and the third argument (args[2]) represents the radius of the circle. The last two argument (args[3] and args[4]) represent the position of the point (args[3], args[4]).
If the point is in the circle, then it would output “true”, otherwise it would output “false”.
Sample output when arguments are: 0 0 1 1 1
Sample output when arguments are: 0 0 1 1 0
Question 5: The reverse number [20 points]
Please write a program to find the reverse number of the integer value of the argument (args[0]) passing by command line, and the range of the integer value is between 1 and 100000. For example, the reverse number of 12345 is 54321, and the reverse number of 210 is 12.
The output for this question is only one row, which is the reverse number of the integer value of argument.
Sample output when argument is: 352
Sample output when argument is: 2430
Question 6: Winning rate of License Plate Number [20 points]
Suppose the winning rate of getting a license plate number of car in Shen Zhen city is 0.28%, and suppose the rate is remain the same in the future. We know that a person has only one chance to participate in rocking the license plate number per month. Please write a program to calculate the least time (how many years and how many months) a person will spend to, the winning rate can be larger than a particular percentage.
Suppose the particular rate is an argument (args[0]) passing by command line, which is an integer number.
The output for this question is only one row, which represents the least time to reach the particular winning rate. Suppose we need 10 years and 2 months to win, the output format will be 10 y 2 m.
Sample output when argument is: 10
Which means you need to spend 3 years and 2 months, the winning rate can be reached to 10%.
Rules
1. Please submit “.java” file of these six questions.
2. The class name of each “.java” file should be A1Q1, A1Q2,……, A1Q6 respectively to represent these six questions.
3. No Chinese characters include.
4. No package include.
5. The arguments and the output must be followed the description of each questions.
Reviews
There are no reviews yet.