A Day 3 Exercise In Learning Java

Discussion in 'Programming General' started by jamesm201, Mar 2, 2011.

A Day 3 Exercise In Learning Java
  1. Unread #1 - Mar 2, 2011 at 5:51 PM
  2. jamesm201
    Joined:
    Feb 7, 2011
    Posts:
    308
    Referrals:
    0
    Sythe Gold:
    22
    Discord Unique ID:
    804740920511561790
    Discord Username:
    CPT72BUG

    jamesm201 Forum Addict

    A Day 3 Exercise In Learning Java

    Today we are going to learn how to make java add up pre set numbers for you.
    Using the template that I've shown you before set up the file and declare the int num and int num2 and result. Then give them a value here i gave each a value. Using both num and num2 we are going to give result the multiplicative value of them multiplied

    Then after declaring it give it a value, for now use the ones i have provided in my file at the bottom. Using the shown bellow give result the num * num 2 number(don't solve it put what i did bellow)
    Then make java execute result to see if it equals what it should equal 14 if not look for mistakes then post on here so i can help you.

    int num;
    int num2;
    int result;

    num = 7;
    num2 = 2;
    result = num * num2;(*for Multiply / for devide - for subtraction + for adding)
    System.out.print("num times num2 equals: ");
    System.out.println(result);
    }
    }
    Thanks for some edits from rsgold4u
     
  3. Unread #2 - Mar 2, 2011 at 6:01 PM
  4. rsgold4u
    Joined:
    Nov 17, 2007
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0

    rsgold4u Forum Addict
    Banned

    A Day 3 Exercise In Learning Java

    if you going to post java code to help people at least post it correctly.

    All of the "system.out.print" MUST be "System.out.print"

    If you are going to add a commend you must have /**/ or //

    If you are going to display numbers in a print statement you must do this.

    system.out.print("num times num2 equals: ");

    MUST BE

    System.out.print(num + "times " + num2 + " equals: ");
     
  5. Unread #3 - Mar 2, 2011 at 6:25 PM
  6. jamesm201
    Joined:
    Feb 7, 2011
    Posts:
    308
    Referrals:
    0
    Sythe Gold:
    22
    Discord Unique ID:
    804740920511561790
    Discord Username:
    CPT72BUG

    jamesm201 Forum Addict

    A Day 3 Exercise In Learning Java

    Your incorrect its optional for putting it all in one system.out.print statement for the sake of them learning it and memorizing it i put it as split. Thanks though that is also another way.
    Thanks its been a long day and i was sick thanks it would suck to see someone mess up from a little error like that
     
  7. Unread #4 - Mar 4, 2011 at 9:50 PM
  8. Quadro
    Joined:
    Feb 4, 2011
    Posts:
    869
    Referrals:
    0
    Sythe Gold:
    0

    Quadro Apprentice
    Banned

    A Day 3 Exercise In Learning Java

    you should use
    Code:
     Code 
    tags
     
< A Day 2 Exercise In Learning Java | 2d simplistic space invaders game >

Users viewing this thread
1 guest


 
 
Adblock breaks this site