-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTester.java
More file actions
25 lines (23 loc) · 732 Bytes
/
Tester.java
File metadata and controls
25 lines (23 loc) · 732 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
public class Tester
{
public static void main(String[] args)
{
char ans;
Scanner keyboard = new Scanner (System.in);
Oblong object; // reference to object created here
do
{
System.out.print("Enter length: ");
double length = keyboard.nextDouble();
System.out.print("Enter height: ");
double height = keyboard.nextDouble();
// new object created each time we go around the loop
object = new Oblong(length, height);
System.out.println("area = "+ object.calculateArea());
System.out.println("perimeter = "+ object.calculatePerimeter());
System.out.print("Do you want another go? ");
ans = keyboard.next().charAt(0);
} while (ans == 'y' || ans == 'Y');
}
}