Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Coding Use the diagram below as a guide to completing the following questions 63

ID: 666407 • Letter: C

Question

Coding Use the diagram below as a guide to completing the following questions 63,64, 65, and 66. Assume all classes 00. Asstume all classes are concrete and are within the same package ClassOne -a: int 1 b: long + e: char + MAX A:int-20 +MAX B: int 30 + add(long, long): int # min(double, double): long - max(double, double): double - min(double, long): double + max(int, int): long + showMAXAO: voicd + showMAXBO: void + truth Value(boolean): boolean ClassTwo ClassThree u: int v: double - w: String - u: int v: double + w: String - add double, double): double + min(double, double): double x: Object - add(float, float): float + min(float, float): float ClassFour - u: int - v: double - w: String + printlt Object): void - add(float, float): float + min(float, float): float

Explanation / Answer


interface IntTwo{
   public void println(Object a);
}

interface IntOne extends IntTwo{
   int MAX_A = 20;
   int MAX_B = 30;
   public long max(int a,int b);
   public void showMAXA();
   public void showMAXB();
}

class imp implements IntOne{
   public void println(Object a){
       System.out.println(a);
   }  
   public long max(int a,int b){
       if (a > b) return (long) a;
       return (long) b;
   }
   public void showMAXA(){
       println(MAX_A);
   }
   public void showMAXB(){
       println(MAX_B);
   }
}

class class_one{
   int a = 10;
   long b;
   char c;
   public class_one(long ab,char ch){
       b = ab;
       c = ch;
   }
   int add(long a,long b){
       return (int)a + (int)b;
   }
   long min(double a,double b){
       if (a > b) return (long) b;
       return (long) a;
   }
   double max(double a,double b){
       if (a > b) return a;
       return b;
   }
   double min(double a,long b){
       if ((double)b > a) return a;
       return (double)b;
   }
}

Question 64:
class class_two{
   int u;
   double v;
   String w;
   public class_two(int a,double b,String c){
       u = a;
       v = b;
       w = c;
   }
   double add(double a,double b){
       return a+b;
   }
   double min(double a,double b){
       if (a > b) return b;
       return a;
   }
}

Question 65:
class class_three {

   int u;
   double v;
   String w;
   Object[] x;
   public class_three(int a,double b,String c,int n){
       u = a;
       v = b;
       w = c;
       x = new Object[n];
   }
   float add(float a,float b){
       return a+b;
   }
   float min(float a,float b){
       if (a > b) return b;
       return a;
   }
}

Question 66:

class class_four{
   int u;
   double v;
   String w;
   public class_four(int a,double b,String c){
       u = a;
       v = b;
       w = c;
   }
   float add(float a,float b){
       return a+b;
   }
   float min(float a,float b){
       if (a > b) return b;
       return a;
   }
}