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: Really simple program problem

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Location
    Maine
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Really simple program problem

    Hey guys, I just got back into java after taking a class on it in high school 2 years ago. I'm trying to make this simple program that tells you in how many hours you'll reach your desired level in an MMORPG. So far my code looks like this:

    import java.util.Scanner;
     
    public class enter {
        public static void main(String[] args) {
     
     
            double ExpToLevel;
            double ExpPerHour;
            double time;
     
            Scanner input = new Scanner(System.in);
     
            System.out.println("Enter your experience until level up");
    		ExpToLevel = input.nextInt();
     
    		System.out.println("How much experience do you get an hour?");
    		ExpPerHour = input.nextInt();
     
     
          ExpToLevel / ExpPerHour = time;
     
          System.out.println("You'll reach your level in " + time);
     
        }
    }

    It's telling me the equation is an unexpected type. How do I fix this problem?


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: Really simple program problem

    You have it @rse-backward. Statement goes on the right and assignment on the left of the equals sign.

  3. #3
    Member
    Join Date
    May 2011
    Location
    west palm beach, FL
    Posts
    189
    My Mood
    Tired
    Thanks
    41
    Thanked 11 Times in 10 Posts

    Default Re: Really simple program problem

    is nice to see someone else using an mmorpg to make one of their first programs too and i used scanner for mine too...should be time = then your equation like junky said

  4. #4
    Junior Member
    Join Date
    Jun 2011
    Location
    Maine
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Really simple program problem

    Wow, I feel like such a moron haha. Thanks for the solution guys!
    Last edited by Jacksontbh; June 29th, 2011 at 10:27 PM.

Similar Threads

  1. please help with simple program!!!
    By jokneez in forum What's Wrong With My Code?
    Replies: 4
    Last Post: April 14th, 2011, 10:42 AM
  2. Simple Chess program
    By x3rubiachica3x in forum What's Wrong With My Code?
    Replies: 23
    Last Post: September 22nd, 2010, 11:12 AM
  3. urgent simple help for a very simple program
    By albukhari87 in forum Java Applets
    Replies: 4
    Last Post: June 5th, 2010, 03:43 PM
  4. simple program
    By Memb in forum Paid Java Projects
    Replies: 0
    Last Post: March 17th, 2010, 01:47 PM
  5. PLEASE HELP!!!! simple java program...
    By parvez07 in forum Object Oriented Programming
    Replies: 5
    Last Post: August 26th, 2009, 06:38 AM