Homework #3 MCIS 5103: Advanced Programming Concepts Instructor: Dr. Justin L. Rice Due Date: 3/1/2023 Please refer to the code in the Appendix (pages 3 – 4) to answer the following questions. 1. Write the output for each section of print statements. (10 points) 2. Which Rectangle constructor does instance box1 call? Why? What concept does this demonstrate? Explain [in four sentences or less].(10 points) 3. Which Rectangle constructor does instance box2 call? Why? What concept does this demonstrate? Explain [in four sentences or less]. (10 points) 4. Which Rectangle constructor does instance box3 call? Why? What concept does this demonstrate? Explain [in four sentences or less]. (10 points) 5. What is the connection between box2 and box4? What happens (memory wise) when both box2 and box 4 are declared null? Explain [in three sentences or less]. (20 points) 6. In the Main class, there are two variables named z. What is the difference between the two variables? What concept does the output of the last three print statements demonstrate? Explain [in four sentences or less]. (20 points) 7. In the Rectangle class, explain the implementation of the Rectangle(int l, int w) constructor. Explain [in four sentences or less]. (10 points) 8. In the Rectangle class, explain the implementation of the Rectangle(Rectangle other) constructor. Explain [in four sentences or less]. (10 points) APPENDIX RectangleVolume.java public class RectangleVolume { public int length; public int width; public int height; public RectangleVolume(int l, int w, int h) { length = l; width = w; height = h; } public RectangleVolume(int l, int w) { this(l, w, 5); } public RectangleVolume(RectangleVolume other) { this(other.length, other.width, other.height); } public int calcVolume(){ return length * width * height; } } Main.java class Main { static int z; public static void main(String[] args) { RectangleVolume box3 = new RectangleVolume(3,4,5); RectangleVolume box1 = new RectangleVolume(box3); RectangleVolume box2 = new RectangleVolume(3,4); RectangleVolume box4 = box2; box1 = null; System.out.println(“n”); System.out.println(“box(l,w,h) = (” + box3.length + “,” + box3.width + “,” + box3.height + “)”); System.out.println(“box(l,w,h) = (” + box4.length + “,” + box4.width + “,” + box4.height + “)”); System.out.println(“box(l,w,h) = (” + box2.length + “,” + box2.width + “,” + box2.height + “)”); box2 = null; System.out.println(“n”); z = 34; System.out.println(“z = ” + z); int z; z = box3.calcVolume(); System.out.println(“z = ” + z); System.out.println(“z = ” + Main.z); } }
by ella | Feb 27, 2023 | >Computer Science homework help
Assigment
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Order Now and we will direct you to our Order Page at https://nectarstudies.com/orders/stud/new Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.