Create a class named Student. A Student has fields for a name, an ID number, num
ID: 3642057 • Letter: C
Question
Create a class named Student. A Student has fields for a name, an ID number, number of credit hours earned, and number of points earned. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields (setters or mutators). A Student also has a field for grade point average. Include a method to compute the grade point average field by dividing points by credit hours earned. Write methods to display the values in each Student field. Save this class as Student.java.Add a constructor for the Student class you created. The constructor should initialize the student name to
Explanation / Answer
package cis35a.project4.JoshBiso; 002 import java.util.Scanner; 003 import java.util.ArrayList; 004 import java.util.Date; 005 006 class Student { 007 private Scanner in = new Scanner(System.in); 008 private String studentName; 009 private long studentID; 010 private String address; 011 private String phone; 012 private boolean fulltimeStatus; 013 private float gpa; 014 private ArrayList courseList; 015 016 public Student(){ 017 } 018 public Student(String studentName, long studentID){ 019 this.studentName=studentName; 020 this.studentID=studentID; 021 } 022 public Student(String studentName, long studentID, String address, String phone, boolean fulltimeStatus, float gpa){ 023 this.studentName = studentName; 024 this.studentID= studentID; 025 this.address=address; 026 this.phone=phone; 027 this.fulltimeStatus= fulltimeStatus; 028 this.gpa=gpa; 029 } 030 031 032 033 034 public void setStudentName(String studentName){ 035 this.studentName=studentName; 036 037 } 038 public void setStudentID(long studentID){ 039 this.studentID=studentID; 040 } 041 public void setAddress(String address){ 042 this.address=address; 043 } 044 public void setPhone(String phone){ 045 this.phone=phone;} 046 047 public boolean setfulltimeStatus(boolean fulltimeStatus){ 048 if(courseList.size()>=3){ 049 this.fulltimeStatus=fulltimeStatus; 050 System.out.print("Fulltime Student"); 051 return true; 052 } 053 else { 054 this.fulltimeStatus=fulltimeStatus; 055 System.out.print("Parttime Student"); 056 return false;} 057 058 } 059 public void setGpa(float gpa){ 060 for(int i=1;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.