A fun MapleStory Private Server.
 
HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Share | 
 

 Java Tutorial #2Making Java do your (extremely) simple algebra homework.

View previous topic View next topic Go down 
AuthorMessage
Zachy
Addicted Cookie
avatar

Posts : 322
Points : 3355
Join date : 2009-07-12
Age : 26
Location : USA

PostSubject: Java Tutorial #2Making Java do your (extremely) simple algebra homework.   Fri Aug 14, 2009 7:03 pm

I dont feel like making an actual tutorial right now so i thought i'd show how to do something simple.

In this one, our equation will be... X=3y*2 where y=8.

Like i said, extremely simple Very Happy, but this works with every algebra prob. When you start working with trig/calculus, Its a bit different to code and you have to import some other classes.

But yea, I'll get to that in a tutorial in maybeh a few weeks. Even though i doubt anyone here actually needs to do that e.e

But in order to do that, Just open DrJava.

In the main code section, put

Code:
class AlgebraTut{
  public static void main(String[] args){
    int b = 3;
    int y = 8;
    int x = b*y;
    int f = x*2;
   
    System.out.println("x=3y*2="+f);
  }
}

I dont have the time right now to say what it means in length, BUT

Basically, Since the equation was x=3y*2, You just set variables, int stands for integer, You're setting b to 3, y to 8. then, you're setting x to b multiplied by y(3*8 for 3y), once you get that, you're setting f to x*2, which is really (3*Cool(2). Thats it :], then, you see i put the actual "equation" in quotes, and then put +f beside it, that way it prints out the variable f next to the equation to give it the look of the equation actually being worked out Very Happy.

I PLAN on eventually putting up some tutorials where you dont actually have to code it over and over again, where you just set variables and allow the user to set the values for the variables and the program do its thang :]

But, that will be a few days, up to 2 weeks. lol
Back to top Go down
View user profile
 
Java Tutorial #2Making Java do your (extremely) simple algebra homework.
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» j-PGN (a lightweight multiplatform java PGN reader)
» Jester java chess program
» speed calculator in java
» Chess by Cellufun 1.0.0.3 for mobile (java)
» Java Chess Protocol Interface

Permissions in this forum:You cannot reply to topics in this forum
SmileyCookieMS :: Programming :: Java-
Jump to: