Can anyone help im trying to write a program that you can pick a number between 1-100 and another line which you can pick numbers from 2-100
then mutiply the end numbers you pick and get a answer...

I dont have much to go on. I really need help... more frustrating!!@#$$ :(

import java.io.*

public class project4 {
public static void main(String)[] arg) throws Exception {
BufferedReader console =
newbufferedReader(newInputStreamReader(System.in));

inputLine = keyboard.readLine();
System.out.print(Pick a number between 1-100);
number1 = console.readLine();
System.out.print(Pick a number between 2-100);
number2 = console.readLine();
int input1,input2;
int = Ineger.parseInt(br.readLine());


This is what I have now. Can you still help?

this code has been modified a little but I still get alot of errors...
Need help bad.

Are you going to type the 2 numbers in? Or do you want them to be generated?

TY for responding I looked in the book found an example
of what I needed inserted and cleared the errors and turned it
in last night at school.
I think im finally getting hang of java.io.*;
:lol:
Bu ty for help Im sure i'll need more in future.

Ok, try this , it may help!

------------------------------------------------------------------
public static void main(String[] args) throws IOException
{
//create a bufferedReader object
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

String number1String;
int number1;
String number2String;
int number2;

//read in first number
System.out.println("Enter first No: ");
System.out.flush();
number1String = in.readLine();
//convert string to integer
number1 = Integer.parseInt(number1String);

//make sure number one is between 1-100, signal error if out of range
while (number1 < 1 || number1 > 100)
{
System.out.println("Invalid number please re-enter: ");
System.out.flush();
number1String = in.readLine();
number1 = Integer.parseInt(number1String);
}

System.out.println("Enter Second No: ");
System.out.flush();
number2String = in.readLine();
//convert string to integer
number2 = Integer.parseInt(number2String);

//make sure number two is between 2-100, signal error if out of range
while (number2 < 2 || number2 > 100)
{
System.out.println("Invalid number please re-enter: ");
System.out.flush();
number2String = in.readLine();
number2 = Integer.parseInt(number2String);
}

System.out.println("First No * Second No = " + (number1 * number2) );
}//end main
}/end class
-------------------------------------------------------------------------
Please leave feedback! rickster

This article has been dead for over six months. Start a new discussion instead.