Question: Problem 1: Code Comprehension [20%] Show the output produced by the following code. Also draw a class-level block diagram on the next page. class Student

 Problem 1: Code Comprehension [20\%] Show the output produced by thefollowing code. Also draw a class-level block diagram on the next page.

Problem 1: Code Comprehension [20\%] Show the output produced by the following code. Also draw a class-level block diagram on the next page. class Student \{ private int sid; protected string name; public Student () ( sid =9; name = null; System, out, printin( "Empty Student"); \} public student (int id, string name) ( sid = id; this. name = name; ) public String tostring() i return sid + ": " + name; \} class CUHK extends Student ( public CUHK() ( super (-8, "Unknown"); System.out.println(this); \} public cuHK(int sid, String n ) \{ super (sid, n ) ; System.out.println(this); \} \} class CSCI extends CUHK \{ public CSCI (int sid, String n ) ( super (); name ="[ CSer ]"+n; System, out.println(this); \} \} class OnlineU extends Student ( public string tostring() 1 return "Onlineu" + super.tostring(); ) ) /* Java application Main class */ class Q1Main ( public static void main(String[] args) l new student () ; new CuHK(); new CuHk (1, "Amy"); new cscI(2,"Mike"); Student sdt = new Onlineu (); system.out.println (sdt); Student [] group = new student [4]; group [0]= new CUHK(3, "John"); group [1]=group[0]; group [2] = new cscI(4, "Mary"); group [3] = new OnlineU(); system.out . println (group [1]) ; ) \} Answer [Output of the above Java application, 12% ]: Answer [OO Diagram showing the class relationships WITHOUT objects and methods, 8\%]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!