|
HELP, just started programming
Hi folks, hope someone can help? I have just started learning Java and I have been asked to create a simple program to calculate wages after the hourly rate is entered in a command line argument. Here is the code:
public class MathDemo
{
public static void main(String[] args[])
{
int rate = 0;
rate = Integer.parseInt(args[0]);
double pay;
pay = rate * 40; //40 hours in a week
System.out.println("The weekly pay is $" + pay);
int bonus;
bonus = 100; //monthly bonus
double annualPay;
annualPay = (pay * 52) + (bonus * 12);
System.out.println("Annual Salary is $" + annualPay);
}
}
Every time I try to compile I get the error:
MathDemo.java:5: cannot resolve symbol
symbol:method parseInt (java.lang.String[])
location:class java.lang.Integer
int rate = Integer.parseInt(args[0]);
There is a little arrow underneath the dot on the bottom line. I cannot for the life of me figure it out, PLEASE HELP, IT IS DOING MY HEAD IN!!!
|