Hello,
I am struggling to find out what im doing wrong in this code. I am new to programming and i am stuck. Ive altered my original code after finding great help online but i am stuck...again. any help will be greatly appreciated.
public class CreateDelivery
{
public static void main(String []args)
{
Scanner input = new Scanner(System.in);
System.out.print(" Enter year ");
int y = input.nextInt();
while ((y<2012) || (y>2025))
{
System.out.println("Please enter a year between 2012 - 2025.");
System.out.print("Please re-enter year:");
y=input.nextInt();
}
System.out.print("Enter delivery number: ");
int no=input.nextInt();
while((no<1) ||(no>9999))
{
System.out.println("Delivery number should be between 1 - 9999.");
System.out.print("Please re-enter delivery number");
no=input.nextInt();
}
System.out.print("Enter weight: ");
double w=input.nextDouble();
while((w<10) || (w>1000))
{
System.out.println("Weight should be in the range of (.10kg - 100kg).");
System.out.print("Please re-enter weight: ");
w=input.nextDouble();
}
System.out.print("Enter delivery code: ");
int code=input.nextInt();
while((code<1) || (code>2))
{
System.out.println("Please enter 1 or 2 for your code number.");
System.out.print("Please re-enter code:");
code=input.nextInt;
}
String num=Integer.toString(no);
String year=Integer.toString(y);
if(num.length()==1)
{
num="000"+ num;
}
else
if(num.length()==2)
{
num="00" + num;
}
else
if(num.length()==3)
{
num="0"+num;
}
String delNo=year+num;
Delivery del=new Delivery(y,no,w,code);
double fees=del.displayFees(code,w);
System.out.println(code + "" + delNo + "" + w + "" + fees);
}
}
The errors i am getting are :
CreateDelivery.java:5: cannot find symbol
symbol : class Scanner
location: class CreateDelivery
Scanner input = new Scanner(System.in);
^
CreateDelivery.java:5: cannot find symbol
symbol : class Scanner
location: class CreateDelivery
Scanner input = new Scanner(System.in);
^
2 errors
----jGRASP wedge: exit code for process is 1.
----jGRASP: operation complete.