Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

identify the type of coupling between the Main and Student classes, explain the issues with this type of coupling, and modify the code to achieve

  1. identify the type of coupling between the Main and Student classes,

  2. explain the issues with this type of coupling, and

  3. modify the code to achieve a better type of coupling and explain how your code achieves this enhanced level of coupling.

Class Instructor {

String name;

String ID;

String Rank;

}

Class Student {

String first_name;

String last_name;

String address;

String ID;

String Classification;

int exam1_grade;

int exam2_grade;

public float calculate_student_avg (Student Stud) {

private int exam1 = Stud.exam1_grade;

private int exam2 = Stud.exam2_grade;

float avg = ((exam1 + exam2)/2);

return avg;

}

}

Class main {

public static void main(String[] args) {

Instructor inst = new Instructor();

Student stud2 = new Student();

stud2.exam1_grade =80;

stud2.exam2_grade =100;

float average = inst.calculate_student_avg(stud2);

}

}

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

2. How will you handle the situation?

Answered: 1 week ago