Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 1.03 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. describe the task
  2. class DE_Roman
  3. {
  4.    private String romanValue;
  5.    private int    intValue;
  6.  
  7.    public void romanToInt(Strin romanValue)
  8.    {
  9.       this.romanValue = romanValue;
  10.  
  11.       int result;
  12.       // ...
  13.       // convert to int and save result in result variable
  14.  
  15.       this.intValue = result;
  16.    }
  17.  
  18.    public void intToRoman(int intValue)
  19.    {
  20.       this.intValue = intValue;
  21.  
  22.       String result = "";
  23.       // ...
  24.       // convert to int and save result in result variable
  25.       this.romanValue = result;
  26.    }
  27.  
  28.    public void println()
  29.    {
  30.       System.out.println( this.toString() );
  31.    }  
  32.  
  33.    public String toString()
  34.    {
  35.       return romanValue + " " + intValue;
  36.    }
  37. }
  38.        
  39. public static final String ROMAN_TYPE   = "String";
  40.  public static final String INTEGER_TYPE = "int";
  41.  public static String getInput(String type) {
  42.    if (type.equals(ROMAN_TYPE)) {
  43.       // prompt for roman number, return int value (as String)
  44.    } else if (type.equals(INTEGER_TYPE)) {
  45.       // prompt for integer number, return roman value (as String)
  46.    }
  47.  }