Hi guys! My name is Josh and I’m relatively new to programming. I am a student at Kennesaw State University and am finishing up my second semester of Java programming. Currently, I wish to hone my skills, as I know they’re lacking, to say the least. I have the basic concepts and syntax down, but freeze when it comes to working problems. My brain isn’t wired to do logical operations. I’m looking for help with the ATM problem. For some reason, when I call my double variable, withdraw, and tell it to withdraw = in.nextDouble, the compiler complains about the dot notation. Can someone please provide guidance? Below is a copy of what I have, along with the error message I receive.
/* package codechef; // don’t place package name! */
import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner in = new Scanner(System.in);
double balance = 120.00;
double withdraw = 0;
System.out.println("Your current balance is: " + balance + "\n");
System.out.println("Enter the ammount you wish to withdraw: ");
withdraw = in.nextDouble;
}
}
Main.java:18: error: cannot find symbol
withdraw = in.nextDouble;
^
symbol: variable nextDouble
location: variable in of type Scanner
1 error