Tywill7
Tywill7

Reputation: 9

My nextDouble(); scanner is giving me a "cannott find symbol" error

I am doing a project for my computer science class and I have run into an issue that wont let me proceed, I ma trying to do a really simple user input question but I keep getting an error. Here is my code and the error:

import java.util.*;

public class BeekeepingIncome{

   public static void main(String [] args)
   {
   double rawHoney;
   double honeyCombs; 
   double rent = 534.99;
   
   Scanner scanner = new Scanner(System.in);
   
   System.out.println("How much honey in pounds was purchased?");
   rawHoney = nextdouble();
   System.out.println("How many honey combs in pounds were purchased?");

   
   
   
   
   }
   
}

BeekeepingIncome.java:20: error: cannot find symbol
   rawHoney = nextDouble();
              ^
  symbol:   method nextDouble()
  location: class BeekeepingIncome
1 error

Any way I can fix this?

Upvotes: 0

Views: 434

Answers (1)

Brian H.
Brian H.

Reputation: 1669

You need to use your Scanner:

rawHoney = scanner.nextDouble();

https://www.w3schools.com/java/java_user_input.asp

https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html

Upvotes: 2

Related Questions