Colm Flaherty

Greenhorn
+ Follow
since Aug 28, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Colm Flaherty

Prog1.java:4: cannot find symbol
symbol : variable sc
location: class Prog1
double f = sc.nextDouble();
^
Prog1.java:6: cannot find symbol
symbol : variable sc
location: class Prog1
double g = sc.nextDouble();

That is the error i receive when i type in the following code

public class Prog1 {
public static void main(String[] args) {
System.out.println("Please Enter Miles");
double f = sc.nextDouble();
System.out.println("Please Enter Gallons");
double g = sc.nextDouble();
System.out.println("Miles per gallon is:");
System.out.println((f/g));
}
}

so what am i doing wrong?
12 years ago