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

consider the following declarations: public class XClass { private int u; privat

ID: 3609773 • Letter: C

Question

consider the following declarations: public class XClass { private int u; private double w; public XClass() {   } public XClass(int a, double w) {    }   public void func() { }   public void print () { } } XClass x=new XClass(10, 20,75); a. How many members dose class XClass have? b.How many private members dose class XClasshave? c.How many constructors dose class XClass have? d.write the definition of the member func so that u is set to10 and w is set to 15.3. e.write the definition of the member printthat prints the contents of u and w. f.write the definition of the defult constructors of the classXClass so that the instance variables are initialized to 0. g.write the definition of the constructors with parameters ofthe class XClass so that the instance variables u isinitialized to the value of a and the instancevariables w is initialized to the value of b. h.write a java statement that prints the values of theinstance variables of x. i.write a java statement that creates the XClass object t andinitializes the instance variables of t to 20 and35.0,respectively. consider the following declarations: public class XClass { private int u; private double w; public XClass() {   } public XClass(int a, double w) {    }   public void func() { }   public void print () { } } XClass x=new XClass(10, 20,75); a. How many members dose class XClass have? b.How many private members dose class XClasshave? c.How many constructors dose class XClass have? d.write the definition of the member func so that u is set to10 and w is set to 15.3. e.write the definition of the member printthat prints the contents of u and w. f.write the definition of the defult constructors of the classXClass so that the instance variables are initialized to 0. g.write the definition of the constructors with parameters ofthe class XClass so that the instance variables u isinitialized to the value of a and the instancevariables w is initialized to the value of b. h.write a java statement that prints the values of theinstance variables of x. i.write a java statement that creates the XClass object t andinitializes the instance variables of t to 20 and35.0,respectively.

Explanation / Answer

a. How many members dose class XClass have?    XClass has 2 members(u and w). b. How many private members dose class XClass have?    XClass also has 2 private members(u and w). c. How many constructors dose class XClass have?    XClass has 2 constructors. d. write the definition of the member func so that u is set to 10and w is set to 15.3.    public void func(){      u = 10;      w = 15.3;    } e. write the definition of the member print that prints thecontents of u and w.    public void print(){      System.out.println("u = " + u);      System.out.println("w = " + w);    } f. write the definition of the defult constructors of the classXClass so that the instance variables are initialized to 0.    public XClass(){       u = 0;       w = 0;    } g. write the definition of the constructors with parameters of theclass XClass so that the instance variables u is initialized to thevalue    public XClass(int a, double w){       u = a;       this.w = w;    } Hope this helps a lot. Rate! Rate! Rate!