PDA

View Full Version : Java input using integers



rj
01-14-2013, 01:38 AM
Recently attempted to pick up java how do I use input like input 2 integers and then with those 2 integers they are used in a math problem. I am making a max calculator for project 2006 but this is what I have so far:


public class Max{

public static void main(String[] args) {
int StrengthLevel = 99;
int StrengthBonus = 54;
int Max = StrengthLevel/3+StrengthBonus/9;
System.out.println("Hit:" + Max);
}

}

x[Warrior]x3500
01-14-2013, 01:58 AM
to input values into the program (sorta like cin) use a Scanner

edit: http://webclass.superquest.net/apjava/JavaNotes%20Reference/notes-java-2006-04-12/notes-java/examples-introductory/console/console-input-scanner.html

rj
01-14-2013, 02:08 AM
x3500;1158441']to input values into the program (sorta like cin) use a Scanner

edit: http://webclass.superquest.net/apjava/JavaNotes%20Reference/notes-java-2006-04-12/notes-java/examples-introductory/console/console-input-scanner.html

Ty.

I hate java. To annoying get so many errors to easily.

Only reason im learning it is because pascal is useless outside of using it for simba

x[Warrior]x3500
01-14-2013, 02:16 AM
Ty.

I hate java. To annoying get so many errors to easily.

Only reason im learning it is because pascal is useless outside of using it for simba

i absolutely love java XD just use eclipse, and all errors are sooo easy to get rid of.
if you wish for an easy way to do this, you can use python. its an over the top easy language to use. you could also just create a c++ or c program for this in like 5 mins.

rj
01-14-2013, 02:19 AM
x3500;1158449']i absolutely love java XD just use eclipse, and all errors are sooo easy to get rid of.
if you wish for an easy way to do this, you can use python. its an over the top easy language to use. you could also just create a c++ or c program for this in like 5 mins.

Yea thats what im using. I heard python is for web based stuff.. and I don't see how I could use or distribute it easily (I.E "Here download my .exe file")

Le Jingle
01-14-2013, 02:27 AM
Pascal is not useless outside of simba...

Perhaps you are thinking about pascalscript... even then you may get some arguments against saying it is useless.

Java is widely used for programming, I'd suggest reading through some basic tutorials to start to get the hang of it. It's quite a useful [universal] language.