. Consider the following class definition that has comments in Figure 5. Add method definitions in the blank areas denoted by …………… for each method as the comment that precedes it indicates. public class Student { private String name; // the student’s full name private String id; // the student ID private int credits; // the amount of credits for study taken so far // Create a new student with a given name and ID number. public Student (String fullName, String studentID) { name = fullName; id = studentID; credits = 0; } // Return the full name of this student. ……………………………………..
[in java]
1. Consider the following class definition that has comments in Figure 5. Add method definitions in the blank areas denoted by …………… for each method as the comment that precedes it indicates.
public class Student
{ private String name; // the student’s full name
private String id; // the student ID
private int credits; // the amount of credits for study taken so far
// Create a new student with a given name and ID number.
public Student (String fullName, String studentID)
{ name = fullName;
id = studentID;
credits = 0; }
// Return the full name of this student.
……………………………………..
// Set a new name for this student.
……………………………………....
// Return the student ID of this student.
………………………………………
// Add some credit points to the student’s accumulated credits.
……………………………………..
/* Check the number of credit points this student has accumulated.
* If it is less than 132, then print “Not yet graduated”, otherwise print “Graduated”.
*/
// Print the student’s name and ID number to the output terminal.
Step by step
Solved in 5 steps with 2 images