View Single Post
Old 11-15-2004, 12:01 PM   #1 (permalink)
merkerguitars
Buffering.........
 
merkerguitars's Avatar
 
Location: Wisconsin...
[java] problem with return statement and placement of {}'s

Ok here is what I have in my Test class
Code:
package a4; 

/** 
* <p>Title: Assignment 4</p> 
* <p>Description: CS 161 Assignment 4 </p> 
* <p>Copyright: Copyright (c) 2004</p> 
* <p>Company: UW-River Falls</p> 
* @author Eric Merker 
* @email ericmerker@centurytel.net 
* @date started: Novemeber 9th 2004 finished: ???? 
* @team prometheusfree.org crew visit us at irc.shadowfire.org at #prometheus 
* @version 1.0 
 */ 


import javax.swing.*; 

public class Test { 
  public Test() { 
  } 

      public static void main(String[] args) { 
      Test test1 = new Test(); 

      int x = Integer.parseInt(JOptionPane.showInputDialog(null, "Enter a number")); 

      } 
  }
And this is what I have in my convert class
Code:
/** 
* <p>Title: Assignment 4</p> 
* <p>Description: CS 161 Assignment 4 </p> 
* <p>Copyright: Copyright (c) 2004</p> 
* <p>Company: UW-River Falls</p> 
* @author Eric Merker 
* @email ericmerker@centurytel.net 
* @date started: Novemeber 9th 2004 finished: ???? 
* @team prometheusfree.org crew visit us at irc.shadowfire.org at #prometheus 
* @version 1.0 
*/ 

import javax.swing.*; 

public class Convert { 
public void print(int x); 
int printPower = x; {{
//missing an open {, and a return type on this line 
if (paraMeter > 12) System.out.println("Does not compute");
 switch (x) { 

case 1: System.out.println("Ten"); 
break; 

case 2: System.out.println("Hundred"); 
break; 

case 3: System.out.println("Thousand"); 
break; 

case 4: System.out.println("Ten Thousand"); 
break; 

case 5: System.out.println("Hundred Thousand"); 
break; 

case 6: System.out.println("Million"); 
break; 

case 7: System.out.println("Ten Million"); 
break; 

case 8: System.out.println("Hundred Million"); 
break; 

case 9: System.out.println("Billion"); 
break; 

case 10: System.out.println("Ten Billion"); 
break; 

case 11: System.out.println("Hundred Billion"); 
break; 

case 12: System.out.println("Trillion"); 
break; }}}
the convert class is the one i'm having problems with, basically I just can't get the return statement correct and the placement of the {}s what the problem does is it takes an input x adn then puts that input into the convert class which matches it up with the proper case statemnet.
__________________
Donate now! Ask me How!

Please use the search function it is your friend.

Look at my mustang please feel free to comment!

http://www.tfproject.org/tfp/showthread.php?t=26985
merkerguitars is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37