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

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 1.39 KB  |  hits: 21  |  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. class triangleAssigment
  2. {
  3.   public static void main (String[] args)
  4.   {
  5.     int a;
  6.     int b;
  7.     int c;
  8.     int a2;
  9.     int b2;
  10.     int c2;
  11.    
  12.     do
  13.     {
  14.       System.out.println("Please enter three sides of a tringle or - 0 0 0 to terminate");
  15.       a = In.getInt();
  16.       b = In.getInt();
  17.       c = In.getInt();
  18.       a2 = a*a;
  19.       b2 = b*b;
  20.       c2 = c*c;
  21.       //declare methods
  22.       if(isFinished(a,b,c) == false)
  23.       {
  24.         determineType(a2,b2,c2);
  25.         classifySides(a,b,c);
  26.         displayValues(a,b,c);
  27.       }
  28.       else
  29.       {
  30.         System.out.println("Program terminated");
  31.       }
  32.     } while(!isFinished(a, b, c));
  33.   }
  34.   // determinbe is isFInished returs true or false
  35.   public static boolean isFinished( int a, int b, int c)
  36.   {
  37.     if(a == 0 && b == 0 && c == 0)
  38.     {
  39.       return true;
  40.      
  41.     }
  42.     else
  43.     {
  44.       return false;
  45.      
  46.     }
  47.   }
  48.  
  49. //determine type of triangle
  50.   public static string determineType(int a2, int b2, int c2)
  51.   {
  52.    String angleType;
  53.     if (a2 + b2 == c2)
  54.     {
  55.      angleType = "right";
  56.     }
  57.     else if(a2 + b2 > c2)
  58.     {
  59.       angleType = "acute";
  60.     }
  61.     else
  62.     {
  63.       angleType = "obtuse";
  64.     }
  65.    
  66.     return angleType;
  67.   }
  68. // classify your triangle by sides
  69.   public static int classifySides(int a, int b, int c)
  70.   {
  71.     if
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. }