Advertisement
oona

JAssess

Aug 25th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. class methods
  2. {
  3.     int add2Value1;
  4.     int add2Value2;
  5.     int total;
  6.     double tempC;
  7.     double tempF;
  8.  
  9.    
  10.     public void add2 (int add2Value1, int add2Value2)
  11.     {
  12.         this.add2Value1 = add2Value1;
  13.         this.add2Value2 = add2Value2;
  14.     }
  15.     public void convertToF (double tempC)
  16.     {
  17.         this.tempC = tempC;
  18.     }
  19.    
  20.    
  21.     public int add2Result ()
  22.     {
  23.         return this.total;
  24.     }
  25.     public double convertToF ()
  26.     {
  27.         return this.tempF;
  28.     }
  29. }
  30.  
  31. public class JAssess {
  32.  
  33.     public static void main(String[] args) {
  34.         // TODO Auto-generated method stub
  35.        
  36.         System.out.println("This is my main method with all sorts of random methods");
  37.         System.out.println("Testing add2");
  38.         System.out.println("Testing convertToF");
  39.         System.out.println("Testing isPalindrome");
  40.         System.out.println("Testing isInOrder");
  41.         System.out.println("Testing addAll");
  42.         System.out.println("Testing countA");
  43.         System.out.println("Testing chooseRandom");
  44.         System.out.println("Testing factorial");
  45.        
  46.     }
  47.    
  48.     public static int add2(int add2Value1, int add2Value2, int total)
  49.     {
  50.         System.out.println("Give 2 values");
  51.         add2Value1 = TextIO.getInt();
  52.         add2Value2 = TextIO.getInt();
  53.        
  54.         total = add2Value1 + add2Value2;
  55.         return total;
  56.     }
  57.     public static double convertToF(double tempC, double tempF)
  58.     {
  59.         System.out.println("Give the temperature in degrees Celsius");
  60.         tempC = TextIO.getDouble();
  61.        
  62.         tempF = tempC*9/5+32;
  63.         return tempF;
  64.     }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement