Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2008, 10:24 PM
Member
 
Join Date: Aug 2008
Posts: 2
TankMurdoch is on a distinguished road
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!!!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2008, 12:32 AM
Member
 
Join Date: Aug 2008
Posts: 3
gedelakranthi is on a distinguished road
you just need to change String args[] instead of String[] args[].
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-07-2008, 10:59 AM
Member
 
Join Date: Aug 2008
Location: The Netherlands
Posts: 22
Rooneyz is on a distinguished road
actually, the right way to do this is:
Code:
public static void main(String[] args) { //rest of method-body }
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 08-07-2008, 03:41 PM
Member
 
Join Date: Aug 2008
Posts: 2
TankMurdoch is on a distinguished road
Thanks folks, worked a treat!! I knew it would be something simple!!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting started ash Advanced Java 1 07-23-2008 12:31 PM
JSP Getting Started. sukatoa JavaServer Pages (JSP) and JSTL 7 07-21-2008 04:08 AM
How do I get started? programmer-in-training New To Java 4 01-11-2008 09:45 AM
Getting Started Doorsmaniac Java Applets 0 11-24-2007 05:40 AM
I need help getting started Android New To Java 2 10-30-2007 06:46 PM


All times are GMT +3. The time now is 01:35 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org