-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectOrientedExample.java
More file actions
33 lines (24 loc) · 1.03 KB
/
Copy pathObjectOrientedExample.java
File metadata and controls
33 lines (24 loc) · 1.03 KB
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
26
27
28
29
30
31
32
33
import java.util.Scanner;
public class ObjectOrientedExample {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Number number;
while(true) {
System.out.print("Enter an integer (or 'exit' to quit): ");
String input = scanner.nextLine();
if (input.equalsIgnoreCase("exit")) {
break;
}
number = new Number(input);
if (!(number.getValue() == 0)) {
System.out.printf("%s divided by 10 is: %.1f%n", number, number.divideBy(10));
} else {
System.out.println("Invalid input. Please enter a non-zero integer.");
}
}
scanner.close();
System.out.println("\nThank you for using the divide by ten system. Goodbye!");
System.out.println("Please leave a rating of your experience in a brief 30 minute survey.");
System.out.println("We're duped into thinking these surveys give us good, mine-able data.");
}
}