-
Notifications
You must be signed in to change notification settings - Fork 5
/
FishFinderLand.java
174 lines (121 loc) · 4.58 KB
/
FishFinderLand.java
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
package components.comp3_objects.project.sp17;
/**
* Created for CIT 111 - Intro to programming Java in Spring 2017
* @author sarah.mikesell
*/
import java.util.Random;
class FishFinder{
private boolean running;
private String location;
private double waterDepth;
private double determineWaterTemperature;
private int numberOfFish;
public void startFinder(){
running = true;
}// close startFinder method
public void stopFinder(){
running = false;
} // close stop finder method
public int locationOne(){
numberOfFish = 4;
return numberOfFish;
} // close location one method
public int locationTwo(int numTwo){
numTwo = numberOfFish + 3;
return numTwo;
} // close location two method
public int locationThree(int numThree){
numThree = numberOfFish + 7;
return numThree;
}
public String depthOfWater(double water){
String depthLocation = "No depth found";
if(water <= 10.5){
depthLocation = "Lake Shore";
} else if (water > 10.5){
depthLocation = "Middle of Lake";
}else if (water >= 40.5){
depthLocation = "Lake Dam";
}
return depthLocation;
} // close method depth of water
public double waterTemperature(double currentTemp){
Random ran = new Random();
int x = ran.nextInt(80)+40;
currentTemp = x ;
return currentTemp;
}
} // close FishFinderLand
public class FishFinderLand {
public static void main(String[] args){
FishFinder finder = new FishFinder();
// call to turn on finder
finder.startFinder();
System.out.println("The fish finder is now on!");
// first fishing spot
System.out.println("Our first fishing spot is the Lake Shore!");
// search for 6 seconds https://www.quora.com/How-do-I-get-a-Java-program-to-wait-before-running-the-next-line-of-code-in-a-simple-hello-world-type-program
try {
System.out.println("Searching for fish.....><>.....");
Thread.sleep(6000);
}
catch (InterruptedException e) {
}
// call to location one
System.out.println("There are " + finder.locationOne()+ " fish near the Shore!");
System.out.println(" ");
// location 2
System.out.println("Our second fishing spot is the middle of the lake!");
// search for 8 seconds
try {
System.out.println("Searching for fish.......><>......");
Thread.sleep(8000);
}
catch (InterruptedException e){
}
// call to location two
System.out.println("There are " + finder.locationTwo(0)+ " fish in the center of the lake!");
//space
System.out.println(" ");
// location number three
System.out.println("Our third fishing spot is at the Dam!");
// search for 10 seconds
try{
System.out.println("Searching for fish........><>......");
Thread.sleep(10000);
}
catch (InterruptedException e){
}
// location call three
System.out.println("Wow, there are " + finder.locationThree(0)+ " fish at the dam!");
//space
System.out.println(" ");
//depth of water
System.out.println("Where is the lake 30 ft deep?");
// search for 5 seconds
try {
System.out.println("Searching for the depth......");
Thread.sleep(5000);
}
catch (InterruptedException e){
}
// find depth of water at certain location
System.out.println(finder.depthOfWater(30));
// space
System.out.println(" ");
//temp
System.out.println("What is the current water temperature?");
//search for 8 seconds
try {
System.out.println("Searching for the temperature......");
Thread.sleep(8000);
}
catch (InterruptedException e){
}
// find water temperature
System.out.println(finder.waterTemperature(0));
// call to turn off finder
finder.stopFinder();
System.out.println("The fish finder is now off!");
} // close class FishFinderLand
} // close class fish finder