Doubt.jpg
Hey guys, so have this computer science project that I am working on, and it seems like I have an input Mismatch exeption in line 17(rate), but i do not understand why, since I used the nextDouble() and used a Double as input, can anyone help?
-----------------------------------------------------------------------------------------------------------------------------
1 package project2;
2
3 import java.util.Scanner;
4
5 public class file1 {
6
7 public static void main(String[] args) {
8
9 Scanner scan = new Scanner(System.in);
10 System.out.print("Pool Lenght (feet): ");
double lenght = scan.nextDouble(); //feet
System.out.print("Pool Widht (feet): ");
double width = scan.nextDouble(); //feet
System.out.print("Desired Depth (inches): ");
double depth = scan.nextDouble();//feet
System.out.print("Rate (gallons/min): ");
17 double rate = scan.nextDouble(); //gallon per minute
double ratecubic = rate * 0.133681; //cubic feet per minute
depth = depth/12;
double volume = (lenght * width * depth); //cubic feet
double second0 = ((volume/ratecubic)*60); //seconds
double hour0 = second0/60; //hour pathwayble
int second1 = (int)Math.round(second0%60); //seconds in a minute
int minute =(int) Math.round(hour0%60); //minutes in an hour
int hour1 = (int)Math.round(hour0/60); //hours
System.out.println(hour1 +":"+ minute + ":" + second1);
}
}
---------------------------------------------------------------------------------------------------------------------------
Here is the code.