Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: What am I missing???

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry What am I missing???

    // File: Investment.java
    // CS256 Lab 2
    // Author: Gary Lee Kuhre
    // Created: January 19, 2014

    public class Investment
    {
    public static void main (String [] args)
    {
    double p, r, y;
    double investment;

    p = (5000.00);
    r = (6.5);
    y = (10);
    Investment = p*(1+(r/100))y;

    Output.showValue("Your Future Investment Value is", investment);

    } // method main

    } // class Investment


    my error below:

    ----jGRASP exec: javac -g Investment.java

    Investment.java:16: error: ';' expected
    Investment = p*(1+(r/100))y;
    ^
    1 error

    ----jGRASP wedge2: exit code for process is 1


  2. #2
    Member Ganeprog's Avatar
    Join Date
    Jan 2014
    Location
    Chennai,India
    Posts
    80
    My Mood
    Love
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default Re: What am I missing???

    Hi,

    you declared variable is "investment" but u assigned value to "Investment" variable. then you should give the expression like this p*(1+(r/100))*y. It will work.

  3. #3
    Junior Member
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: What am I missing???

    I fixed it like this,

    // File: Investment2.java
    // CS256 Lab 2
    // Author: Gary Lee Kuhre
    // Created: January 19, 2014

    public class Investment2
    {
    public static void main (String [] args)
    {
    double p, r, y;
    double z;

    p = (3500.00);
    r = (3.6);
    y = (25);
    z = p*(1+(r/100))*y;


    Output.showValue("Your Future Investment Value is", z);

    } // method main

    } // class Investment2

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: What am I missing???

    Welcome to the Forum! Please read this topic to learn how to post your code correctly along with other useful info for newcomers.

Similar Threads

  1. Missing Loop, not sure what I need
    By ZorraBella in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 28th, 2013, 07:55 PM
  2. [SOLVED] 'ELSE' missing 'IF'
    By Andrew Red in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 30th, 2013, 11:51 AM
  3. What am I missing?
    By jean28 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 28th, 2012, 10:49 AM
  4. What am I missing?
    By prgmrGrl in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 10th, 2012, 12:33 AM
  5. missing something so simple....help!
    By b094mph in forum What's Wrong With My Code?
    Replies: 6
    Last Post: October 17th, 2011, 10:12 PM