Hi, I am very new to computer science. Can you pls explain your answer like I am an idiot? So sorry for the trouble. A

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

Hi, I am very new to computer science. Can you pls explain your answer like I am an idiot? So sorry for the trouble. A

Post by correctanswer »

Hi, I am very new to computer science. Can you pls
explain your answer like I am an idiot? So sorry for the
trouble.

A management system for a university includes the following Java
classes. (Methods are not shown).


class Student {
String regno, name;
List<Module> modules;
}

class Module {
String code, name;
List<Student> students;
}


(i) Write a JSP fragment that will display in tabular form the
names and codes of all of the modules taken by a student, and also
the total number of modules taken by that student. You should
assume that a reference to the student is available in a variable
called stud of type Student

(ii) Briefly describe one weakness in the design of the classes
shown above and suggest a better approach.

For part (i) i really have no idea, pls help me with
that.

For part (ii) pls find my answer here and let me know how it can be
better.

Answer(ii):
The class design has tight coupling which is not ideal. For example
every time there is a new module we will add it to the Student list
and vice versa, this seems to be an unnecessary dependency. This
means that the student class cannot do without the module class and
likewise, should we need to make changes to either of the classes
it may affect the other class.
Loosely coupled modules are easier to develop and maintain since
they are independent of each other and can hence be modified and
updated without affecting each other.
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply