SmileyCookieMS
Would you like to react to this message? Create an account in a few clicks or log in to continue.


A fun MapleStory Private Server.
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log in  

 

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

Go down 
AuthorMessage
Zachy
Addicted Cookie
Zachy


Posts : 322
Points : 5725
Join date : 2009-07-12
Age : 32
Location : USA

Java Tutorial #2Making Java do your (extremely) simple algebra homework. Empty
PostSubject: Java Tutorial #2Making Java do your (extremely) simple algebra homework.   Java Tutorial #2Making Java do your (extremely) simple algebra homework. EmptyFri 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
 
Java Tutorial #2Making Java do your (extremely) simple algebra homework.
Back to top 
Page 1 of 1
 Similar topics
-
» Extremely simple suggestion
» A java forum D:
» Simple way...
» Simple programs#1& how it works/what makes it up

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