Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data 29th British National Conference On Databases Bncod 2013 Oxford Uk July 2013 Proceedings Lncs 7968

Authors: Dan Olteanu ,Georg Gottlob ,Christian Schallhart

2013th Edition

3642394663, 978-3642394669

More Books

Students also viewed these Databases questions

Question

=+26-1 Define learning, and identify some basic forms of learning.

Answered: 1 week ago