Uploaded by ndzuselunathi375

Assignment1 Peer 1

advertisement
Assignment 1 Rubric
Criteria
Student name:
Correct
10
partially
5
Incorrect
0
10
5
0
public int diameter() { return
radius * 2; }
public double circumference() {
return Math.PI * radius * 2; }
10
5
0
10
5
0
public double area() { double x =
Math.pow(radius,2); return
Math.PI * x; }
10
5
0
import javax.swing.JOptionPane;
10
5
0
String rad1 =
JOptionPane.showInputDialog("pl
ease enter the radius of Circle
1:");
10
5
0
Circle circle1 = new Circle();
circle1.setRadius(Integer.parseInt(
rad1)); OR Circle circle2 = new
Circle(Integer.parseInt(rad2));
10
5
0
JOptionPane.showMessageDialog
(null, String.format("Circle
1:\n%d\n%d\n%.2f\n%.2f\n",circl
e1.getRadius(),circle1.diameter(),
circle1.circumference(),circle1.are
a()));
10
5
0
Program compiles
and executes
successfully
10
5
0
Total
95
Circle class
constructors:
default and one
with a parameter.
Circle class: getand set- methods
for radius
attribute.
Circle class:
diameter method:
Circle class
circumference
method: Math.PI
was used.
Circle class area
method: Math.PI
and Math.pow was
used
TestCircle class
with import
statements, only
one attribute
(radius) and main
method:
TestCircle class:
correct use of
showInputDialog
method for user
radius input
TestCircle class:
construct Circle
object and initialize
radius attribute
10% of total mark
TestCircle class:
correct use of
showMessageDialo
g method to display
all values
Sample solution
Download