Question: Why I can't run this coding? I think I got problem at main method, but don't know how to fix 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; // set credits to be 0    } // Return the full name of this student.    public String getName() {    return name;// returns the name    } // Set a new name for this student.    public void setName(String n) {       name = n;// set n as name of Studentt    } // Return the student ID of this student.    public String getId() {    return id;// return the id of the student    } //Add some credit points to the student’s accumulated credits.    public void addCreditPoints(int points) {    credits = credits + points;// add to existing 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”.   *    */    public void checkCredits() {    if (credits < 132)// credit points less than 132       System.out.println("Not yet graduated");    else// otherwise       System.out.println("Graduated");    } //Print the student’s name and ID number to the output terminal.    public void print() { System.out.println("Name: "+name+", ID: "+id); }    public static void main(String [] args) {       Student s=new Student("Anis","1234");       s.addCreditPoints(100);       s.printGraduationStatus();       s.addCreditPoints(34);       s.printGraduationStatus();       s.print();    }  }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Question: Why I can't run this coding? I think I got problem at main method, but don't know how to fix

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; // set credits to be 0
   }
// Return the full name of this student.
   public String getName() {
   return name;// returns the name
   }

// Set a new name for this student.
   public void setName(String n) {
      name = n;// set n as name of Studentt
   }

// Return the student ID of this student.
   public String getId() {
   return id;// return the id of the student
   }

//Add some credit points to the student’s accumulated credits.
   public void addCreditPoints(int points) {
   credits = credits + points;// add to existing 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”.
  * 
  */
   public void checkCredits() {
   if (credits < 132)// credit points less than 132
      System.out.println("Not yet graduated");
   else// otherwise
      System.out.println("Graduated");
   }

//Print the student’s name and ID number to the output terminal.
   public void print() {

System.out.println("Name: "+name+", ID: "+id);

}
   public static void main(String [] args) {

      Student s=new Student("Anis","1234");

      s.addCreditPoints(100);

      s.printGraduationStatus();

      s.addCreditPoints(34);

      s.printGraduationStatus();

      s.print();

   } 
}

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY