-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoWhileSwim.java
More file actions
26 lines (23 loc) · 828 Bytes
/
doWhileSwim.java
File metadata and controls
26 lines (23 loc) · 828 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
/**
* Created by fattyduck on 3/24/15.
*/
import java.util.Scanner;
public class doWhileSwim {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
String swimmer1="cow";
double minimumTemp=70;
double currentTemp, savedTemp;
int swimTime=0;
System.out.println("What is the current water temperature?");
currentTemp=scanner.nextDouble();
savedTemp=currentTemp;
do{
swimTime++;
System.out.println("\t" +swimmer1+" swims for " +swimTime);
currentTemp-=.5;
System.out.println("\tThe temperature is now "+currentTemp+ "degrees");
}while(currentTemp>=minimumTemp);
System.out.println(swimmer1+ " stopped swimming, total swim time: "+swimTime+" min.");
}
}