You have a file University.java and you have a driver class…

You have a file University.java and you have a driver class named Driver.java. Fill in the correct visibility modifiers so that the comments in the main method are upheld. public class Driver {    public static void main(String[] args) {     University t = new University(); // each of the lines below is run independently     System.out.println(t.numBuildings);    // compiles and runs     System.out.println(t.getAverageGpa()); // compiles and runs     System.out.println(t.averageGpa); // compile error    }} —— in a separate file in a different package/directory ——— public class University {   1 int numBuildings;   2 double averageGpa;   3 double getAverageGpa() {       return averageGpa;    }   /** no-argument constructor implemented **/}   1  :[vis1]   2  :[vis2]   3  :[vis3]

Given the code below, what is printed?  public class Operati…

Given the code below, what is printed?  public class Operations {   public static void main(String[] args) {        int a = 6;        int b = method1(a);        System.out.print(a + “,”);        System.out.print(b);     }    public static int method1(int b) {        int c = b * 2;        b = b + 4;        return c;    } } 

Fill in the blanks for the method signature of a Deep Copy c…

Fill in the blanks for the method signature of a Deep Copy constructor for the Candle class. public class Candle {     private String scent;     private double radius;     private int height;     /* Valid constructor header that takes in all variables*/ {         scent = smell;         radius = candleBase;         height = candleHeight;     }  /** Deep Copy Constructor **/ 1 2 3 ( 4 ) {   /** body implemented **/ }}   1  :[1]   2  :[2]   3  :[3]   4  :[4]

Fill in the blanks for the method signature of a Deep Copy c…

Fill in the blanks for the method signature of a Deep Copy constructor for the Plant class. public class Plant {     private String type;    private int height;     private boolean seedStage;     /* Valid constructor header that takes in all variables*/ {        type = plantType;         height = plantHeight;         seedStage = seed;     } /** Deep Copy Constructor **/ 1 2 3 ( 4 ) {   /** body implemented **/ }}   1  :[1]   2  :[2]   3  :[3]   4  :[4]

For the given method header, make a copy of the array passed…

For the given method header, make a copy of the array passed in that squares(i.e. multiplies by itself) every other VALUE in the array, starting with the first element. You may assume the passed in array will not be null and contain at least 2 values.   For example, if the input array is: 4 5 -2 -3 9 Then the returned COPY of the array (not the original array) would be:  16 5 4 -3 81 Here is the method header: public int[] square(int[] input) (You do not have to include the method curly braces.)   Make sure to select the ‘Preformatted’ style from the dropdown so your code is formatted clearly. DO NOT USE THE TAB KEY WHEN WRITING CODE AS YOU MAY ACCIDENTALLY SUBMIT YOUR EXAM. USE THE SPACE BAR INSTEAD.

Convert the following while-loop into an equivalent for-loop…

Convert the following while-loop into an equivalent for-loop as closely as possible using the code snippet bank and template below. It is not enough for the loop to be functionally identical; it needs to follow any patterns mentioned in lecture.  int j = 9;while ( j > 0 ) {   j–;   System.out.println(j);   j /= 2;} for (1. _____________; 2._____________; 3._____________)  { 4. _____________;   System.out.println(j);}

Convert the following while-loop into an equivalent for-loop…

Convert the following while-loop into an equivalent for-loop as closely as possible using the code snippet bank and template below. It is not enough for the loop to be functionally identical; it needs to follow any patterns mentioned in lecture. int i = 0; while ( i 

For the given code below, which lines are valid (will compil…

For the given code below, which lines are valid (will compile and run)? Assume each line is run independently.   public class Bean {     private static boolean small;     private int value;     public static int grow() {         return 0;     }     public double wilt() {         return 0.0;     }     public static void main(String[] args) {         Bean obj = new Bean();         1 Bean.wilt();         2 Bean.grow();         3 obj.wilt();         4 obj.grow();                                     5 System.out.println(Bean.value);         6 System.out.println(Bean.small);         7 System.out.println(obj.value);           8 System.out.println(obj.small);   } }   1  : [1]   2  : [2]   3  : [3]   4  : [4]   5  : [5]   6  : [6]   7  : [7]   8  : [8]