-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappleTester.java
More file actions
37 lines (33 loc) · 1013 Bytes
/
appleTester.java
File metadata and controls
37 lines (33 loc) · 1013 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
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Jiarong Xu
*/
public class appleTester {
public static void main(String[] args) {
System.out.println("Welcome to the apple tester");
System.out.println("Create default apple");
// default apple 1
Apple a = new Apple();
System.out.println("Printing the default apple's value");
System.out.println(a.toString());
//apple 2
System.out.println("Create another apple");
Apple b = new Apple ();
b.setType("GrannySmith");
b.setWeight(0.75);
b.setPrice(0.99);
System.out.println("Printing the new apple's value");
System.out.println(b.toString());
//apple 3
System.out.println("Create another apple");
Apple c = new Apple ();
b.setType("ipad");
b.setWeight(2.5);
b.setPrice(-200);
System.out.println("Printing the new apple's value");
System.out.println(c.toString());
// Check
System.out.println("Checking the first and last apple have the same values.");
boolean answer = a.equals(b);
System.out.println(answer);
}
}