# Need help!!!!!

• April 25th, 2013, 07:52 PM
Need help!!!!!
Code java:

```// 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 head1 = "Number: "; 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. System.out.println(head1 + numberCounter); System.out.println(head2 + doubled); System.out.println(head3 + tripled); 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. >```
• April 25th, 2013, 07:56 PM
Norm
Re: Need help!!!!!
Do you have a question you meant to ask?

[code=java]
[/code]
to get highlighting and preserve formatting.
• April 25th, 2013, 08:01 PM
Re: Need help!!!!!
Yes I want to know how I can make it run?
• April 25th, 2013, 08:03 PM
Norm
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)
• April 25th, 2013, 08:08 PM
Re: Need help!!!!!
It is not compiling. I have errors, I do not know what I did wrong
• April 25th, 2013, 08:10 PM
Norm
Re: Need help!!!!!
Quote:

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

[code=java]
[/code]
to get highlighting and preserve formatting.
• April 25th, 2013, 08:13 PM
Re: Need help!!!!!
ok
• April 25th, 2013, 08:16 PM
Norm
Re: Need help!!!!!
Where are the error messages?
• April 25th, 2013, 08:18 PM
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.
• April 25th, 2013, 08:24 PM
Norm
Re: Need help!!!!!
Copy the full text of the error messages and paste it here.
• April 25th, 2013, 08:27 PM
Re: Need help!!!!!
can't copy the error, but here it is
'else' without if

else
^
• April 25th, 2013, 08:30 PM
Norm
Re: Need help!!!!!
Check that the {}s are properly paired. The statement should look somthing like this:
Code :

``` if(some condition) { // do some stuff here } else { // do something else here }```
• April 25th, 2013, 08:35 PM
Re: Need help!!!!!
error message of:
illegal start of type
}else{
^
• April 25th, 2013, 08:37 PM
Norm
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.
• April 25th, 2013, 08:38 PM
Re: Need help!!!!!
yes
• April 25th, 2013, 08:38 PM
Norm
Re: Need help!!!!!
Yes ???
• April 25th, 2013, 08:40 PM
Re: Need help!!!!!
I placed them exactly the way you placed it. it gave me the same error message
• April 25th, 2013, 08:41 PM
Norm
Re: Need help!!!!!
I can't see what you did if you don't post the code that shows the problem.
• April 25th, 2013, 08:44 PM
```<// 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 head1 = "Number: "; 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. System.out.println(head1 + numberCounter); System.out.println(head2 + doubled); System.out.println(head3 + tripled); 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.>```