Question: Complete java program by adding method swapMark() Java program implementation Complete the following java program by adding a method swap Mark() to swap two reference

Complete java program by adding method swapMark()

Java program implementation Complete the following java program by adding a method

Java program implementation Complete the following java program by adding a method swap Mark() to swap two reference variables. The two student marks must be swapped by the method. Please do not delete the existing code. The tests will be executed automatically. For example: Test Student s1 = new Student (50); Student s2 = new Student (100); Course course = new Course(); course.swapMark(s1, s2); course.displayMark (s1, s2); Student s1 = new Student (50); Student s2 = new Student (100); Course course = new Course(); course.swapMark(s1, s2); course.swapMark(s1, s2); course.displayMark (s1, s2); Result std1 mark: 100.0, std2 mark: 50.0 std1 mark: 50.0, std2 mark: 100.0 Answer: (penalty regime: 0 %) Reset answer 1 class Student{ private double mark; public Student (double m) { mark=m; public double getMark() { return mark; public void setMark (double newMark) { mark=newMark; 2 3 4 5 6 } 7 8 9 10 11 12- 13 14 15 16 25 26 PENNY222222222222 27 } } } } } 17 class Course{ public void swap Mark (Student s1, Student s2) { //add your code here 18 19-> 20 21 } 23 24 public void displayMark (Student s1, Student s2){ System.out.println("std1 mark: "+s1.getMark()+", std2 mark: "+s2.getMark());

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 Programming Questions!