School assignment, so this code is meaningless. Whenever I try to use a char, I always seem to get this error
LetsGoShop.java:14: error: cannot find symbol
item = input.nextChar();
^
symbol: method nextChar()
location: variable input of type Scanner
1 error
Heres the actual code :
import java.util.Scanner;
public class LetsGoShop {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in);
char item ;
int price;
int quantity;
System.out.println(" Enter the name of the item : ");
item = input.nextChar();
System.out.println(" Enter the price of said item : ");
price = input.nextInt();
System.out.println(" Enter how much of said item you want to buy : ");
quantity = input.nextInt();
double total = price * quantity ;
item = Character.toUpperCase(item);
System.out.println(" You owe " +total+ " for " +quantity + item);
}
}
I am just beginning to code, so if the answers obvious, I wouldn't have guessed it.