Part 1
Given the following code:
public class MyClass {
private double score;
private String studentID;
//code of the class
.....
} //end of MyClass
Code a default constructor and an overloaded constructor of MyClass that will assign values to its two instance fields:
Please write in JAVA
Part 2
Continue from question about, code an mutator of instance field
called studentID:
public class MyClass { private double score; private String studentID; public MyClass() { } public MyClass(double score, String studentID) { this.score = score; this.studentID = studentID; } } //end of MyClass
public class MyClass { private double score; private String studentID; public MyClass() { } public MyClass(double score, String studentID) { this.score = score; this.studentID = studentID; } public void setStudentID(String studentID) { this.studentID = studentID; } } //end of MyClass
Get Answers For Free
Most questions answered within 1 hours.