Question: Question 5 (5 points) For the questions below: Assume this Student class: public class Student { String name; int id; double mark1, mark2; Student

Question 5 (5 points) For the questions below: Assume this Student class:

Question 5 (5 points) For the questions below: Assume this Student class: public class Student { String name; int id; double mark1, mark2; Student (String n, int i, double m1, double m2) { name = n; id i; mark1 = m1; mark2 m2; } void info() { System.out.println("Id: "+id+" Name: "+name); } double sum( ) { return mark1 + mark2; } }//end class Student Answer the following questions. 1. Write the statement to instantiate an object for Student class as "myStu", and pass the parameters values as follows: name as Mary, id as 123, mark1 as 95, and mark2 as 100 2. Write a statement to print the "sum method" using Student class object. 3. Write a statement to print the "info method" using Student class object. 4. Add a constructor to class Student, which has 2 parameters, which is name and id. 5. Write a statement to instantiate a two parameter constructor with an object "myStu1" and pass the parameter value of name as Robin and id as 350.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 To instantiate an object for the Student class as myStu and pass the parameter values java Student ... View full answer

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!