How do I Design & test a Rectangle class?

  • Thread starter Thread starter Just Incredible
  • Start date Start date
J

Just Incredible

Guest
This is my code so far, I have made a main class that ask users to enter a number and a test class to test numbers being entered, I don't know if I have done it right

public class Rectangle {

public static void main(String args[]){


int choice;
String str;
double rectangle;

str = JOptionPane.showInputDialog(
"Type 1 to run the test, 0 to enter your details ");
choice = Integer.parseInt(str);

if (choice == 1)
test();
else
{
str = JOptionPane.showInputDialog("Please enter a number");
rectangle= Integer.parseInt(str);

rectangle (str);


}

for(int Counter=1; i<11; i++)

{Counter counter1 = new Counter();

System.out.println("current count is" + counter1.getCurrentCount());

counter1.incrementCount();

System.out.println("current count is" + counter1.getCurrentCount());

counter1.reset();

System.out.println("current count is" + counter1.getCurrentCount());
}
}

public static void test()
{
rectangle (6);
rectangle (5);
rectangle (10);
rectangle (13);
rectangle (20);
}



}
 
Back
Top