create a class named student. Student has fields for an ID number, number of cre
ID: 3633398 • Letter: C
Question
create a class named student. Student has fields for an ID number, number of credit hours earned and number of points earned. Include methods to assign values to all fields. Student also has a field for grade point average filed by dividing points by credit hours earned and Write a class named ShowStudent that instantiates a Student object from the class you created and assigns values to its fields. Compute the Student grade point average, and then display all the values associated with the Student. Save the application as ShowStudent.javaCreate a constructor for the Student class you created. The constructor should initialize each Student's ID number to 9999, his or her points earned to 12, and credit hours to 3 (resulting in a grade point average of 4.0). Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values. Save the application as ShowStudent2.java
--------------------------------------------------------------------------------
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
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.