Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## Need help!!!!!

```// This program prints the numbers that a user enters through another number entered by user along
// with these values multiplied by 2 and by 3.
// Input:  two integer not necessary in order
// Output: Prints the smaller entered number through the larger along with their values multiplied by 2 and by 3.
<
import javax.swing

public class FinalExamFall2012
{
public static void main(String args[])
{
String head2 = "Multiplied by 2: ";
String head3 = "Multiplied by 3:  ";
int numberCounter = 0;
int doubled;		// Stores the number multiplied by 2.
int tripled; 	        // Stores the number multiplied by 3.
string SmallerNumString;
String LargerNumString;
double SmallerNum;
double LargerNum;
int Number;
final int NUM_LOOPS = 2;
//decalr variables to accept input
//convert input into integers
//int SmallerNum, LargerNum;
//assign the small number entered to SmallerNum using if condition

if (numberCounter > LargerNum)
{
SmallerNum = LargerNum;
}

LargerNum = numberCounter;
{

else
(numberCounter > SmallerNum)
{

SmallerNum = numberCounter;

}

//assign larger num to appropriate variable
Number = JOptionPane.showInputDialog("Enter Number: ");

SmallerNum = Double.parseDouble(SmallerNumString);
LargerNum = Double.parseDouble(largeerNumString);

System.out.println(SmallerNum + "  through ” + LargerNum + “  multiplied by 10 and by 100" + "\n");

numberCounter = SmallerNum;
// use a do while loop
do
{
doubled = numberCounter * 2;
tripled = numberCounter * 3;
// Multiply by 2.
// Multiply by 3.
numberCounter++;
System.out.print("\n");
}

while(numberCounter  <= NUM_LOOPS );

//cosntruct while loop condition
// End of do while loop.
// This is the work done in the endOfJob() method
System.exit(0);
} // End of main() method.

}
// End class.
>```

2. ## Re: Need help!!!!!

Do you have a question you meant to ask?

[code=java]
[/code]
to get highlighting and preserve formatting.

3. ## Re: Need help!!!!!

Yes I want to know how I can make it run?

4. ## Re: Need help!!!!!

To run a java program, first compile it with the javac command, then execute it with the java command.
See an example in the tutorial: "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)

5. ## Re: Need help!!!!!

It is not compiling. I have errors, I do not know what I did wrong

6. ## Re: Need help!!!!!

I have errors
Copy the full text of the error messages and paste it here.

[code=java]
[/code]
to get highlighting and preserve formatting.

ok

8. ## Re: Need help!!!!!

Where are the error messages?

9. ## Re: Need help!!!!!

on the else and it is not compelling
the program is suppose to Prints the smaller entered number through the larger along with their values multiplied by 2 and by 3.

10. ## Re: Need help!!!!!

Copy the full text of the error messages and paste it here.

11. ## Re: Need help!!!!!

can't copy the error, but here it is
'else' without if

else
^

12. ## Re: Need help!!!!!

Check that the {}s are properly paired. The statement should look somthing like this:
```  if(some condition) {
//  do some stuff here
} else {
// do something else here
}```

13. ## Re: Need help!!!!!

error message of:
illegal start of type
}else{
^

14. ## Re: Need help!!!!!

Check that the {}s are properly paired.

I can't tell why the compiler gives that error without seeing a lot of the code that comes before the statement with the error.

yes

Yes ???

17. ## Re: Need help!!!!!

I placed them exactly the way you placed it. it gave me the same error message

18. ## Re: Need help!!!!!

I can't see what you did if you don't post the code that shows the problem.

19. ## Re: Need help!!!!!

```<// This program prints the numbers that a user enters through another number entered by user along
// with these values multiplied by 2 and by 3.
// Input:  two integer not necessary in order
// Output: Prints the smaller entered number through the larger along with their values multiplied by 2 and by 3.

//import javax.swing

public class FinalExamFall2012
{
public static void main(String args[])
{
String head2 = "Multiplied by 2: ";
String head3 = "Multiplied by 3:  ";
int numberCounter = 0;
int doubled;		// Stores the number multiplied by 2.
int tripled; 	        // Stores the number multiplied by 3.
string SmallerNumString;
String LargerNumString;
double SmallerNum;
double LargerNum;
int Number;
final int NUM_LOOPS = 2;
//decalr variables to accept input
//convert input into integers
//int SmallerNum, LargerNum;
//assign the small number entered to SmallerNum using if condition

if (numberCounter > LargerNum)
{
SmallerNum = LargerNum;
}

LargerNum = numberCounter;

} else {
(numberCounter > SmallerNum)
{

SmallerNum = numberCounter;

}

//assign larger num to appropriate variable
Number = JOptionPane.showInputDialog("Enter Number: ");

SmallerNum = Double.parseDouble(SmallerNumString);
LargerNum = Double.parseDouble(LargerNumString);

System.out.println(SmallerNum + "  through ” + LargerNum + “  multiplied by 10 and by 100" + "\n");

numberCounter = SmallerNum;
// use a do while loop
do
{
doubled = numberCounter * 2;
tripled = numberCounter * 3;
// Multiply by 2.
// Multiply by 3.
numberCounter++;
System.out.print("\n");
}

while(numberCounter  <= NUM_LOOPS );

//cosntruct while loop condition
// End of do while loop.
// This is the work done in the endOfJob() method
System.exit(0);
}
// End of main() method.

}
// End class.>```

20. ## Re: Need help!!!!!

Check that the {}s are correctly paired.