Question

In: Computer Science

This is 1 java question with 3 parts/codes called student.java, ShowStudent.java, ShowStudent2.java. Thanks so much! Create...

This is 1 java question with 3 parts/codes called student.java, ShowStudent.java, ShowStudent2.java. Thanks so much!

  1. Create a class named Student that has fields for 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. 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.

  2. Use class named ShowStudent that instantiates a Student object to test your class. Compute the Student grade point average, and then display all the values associated with the Student.

  3. Create 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.

Please double check your work and complete all three parts. This is my FOURTH TIME posting and each solution I've received has been incomplete/had errors. Please only help if you can complete all parts, I would appreciate it.

Solutions

Expert Solution

Student.java

public class student {   
    private int id;
                private int hours;
                private int points;
                private double GPA;  
                
                
                public student(int id,int points , int hours){
                        setStudentId(id);
                        setHours(hours);
                        setPoints(points);
                        setGPA();
                        
                        
                        
                }
                public student(){
                        setStudentId(9999);
                        setHours(3);
                        setPoints(12);
                        setGPA();
                        
                        
                }
              
                public void setStudentId(int id)
                        {
                                this.id = id;
                        }
                public int getStudId()
                        {
                                return id;
                        }
                public void setHours(int hours)
                        {
                                this.hours = hours;
                        }
                public int getHours()
                        {
                                return hours;
                        }
                public void setPoints(int points)
                        {
                                this.points = points;
                        }
                public int getPoints()
                        {
                                return points;
                        }
                public void setGPA()
                        {
                                GPA = points/ hours;
                        }
                public double getGPA()
                        {
                                return GPA;
                        }
                
                public void displayStudentDetails()
                        {
                            
                                System.out.println("Student Id: " + getStudId());
                                System.out.println("Credit Hours Earned: " + getHours());
                                System.out.println("Points Earned: " + getPoints());
                                System.out.println("Grade Point Average: " + getGPA());
                        }
 
        
 
    }

ShowStudent.java

public class ShowStudent {
    public static void main(String[] args){{
        student s = new student();
        
        s.setStudentId(1234);
        s.setHours(3);
        s.setPoints(12);
        s.setGPA();
        s.displayStudentDetails();
        System.out.println("");
        
}
}
}

ShowStudent2.java

public class ShowStudent2 {
    public static void main(String[] args){
    {
       
        {
                
                        student s = new student();
                        s.displayStudentDetails();
                        System.out.println("");
                
                
        }
}
    
}}

Related Solutions

This is 1 java question with its parts. Thanks so much! Create a class named Student...
This is 1 java question with its parts. Thanks so much! Create a class named Student that has fields for 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. A Student also has a field for grade point average....
This is 1 java question with its parts. Thanks! Create a class named Lease with fields...
This is 1 java question with its parts. Thanks! Create a class named Lease with fields that hold an apartment tenant’s name, apartment number, monthly rent amount, and term of the lease in months. Include a constructor that initializes the name to “XXX”, the apartment number to 0, the rent to 1000, and the term to 12. Also include methods to get and set each of the fields. Include a nonstatic method named addPetFee() that adds $10 to the monthly...
need a detailed answer so much. Thanks a lot! The question is: "Describe the difference between...
need a detailed answer so much. Thanks a lot! The question is: "Describe the difference between diffraction and dispersion, by discussing the different physical processes (for example refraction) that give rise to the two phenomena."
Any Answer is appreciated. Thanks so much! QUESTION 15 "If an attacker wanted to cause serious...
Any Answer is appreciated. Thanks so much! QUESTION 15 "If an attacker wanted to cause serious damage in the real world, which of the following systems would be the most likely target?" SCUBA systems SCAPA systems SCODA systems SCADA systems QUESTION 19 Which of the following is often described as the weak link in cybersecurity defenses? Firewalls Intrusion Detection People Money 3 points    QUESTION 20 "Attackers will inspect, observe, and survey a target in order to build a(n) __________...
please write the java code so it can run on jGRASP Thanks! CODE 1 1 /**...
please write the java code so it can run on jGRASP Thanks! CODE 1 1 /** 2 * SameArray2.java 3 * @author Sherri Vaseashta4 * @version1 5 * @see 6 */ 7 import java.util.Scanner;8 public class SameArray29{ 10 public static void main(String[] args) 11 { 12 int[] array1 = {2, 4, 6, 8, 10}; 13 int[] array2 = new int[5]; //initializing array2 14 15 //copies the content of array1 and array2 16 for (int arrayCounter = 0; arrayCounter < 5;...
please write the java code so it can run on jGRASP Thanks! 1 /** 2 *...
please write the java code so it can run on jGRASP Thanks! 1 /** 2 * PassArray 3 * @Sherri Vaseashta 4 * @Version 1 5 * @see 6 */ 7 import java.util.Scanner; 8 9 /** 10 This program demonstrates passing an array 11 as an argument to a method 12 */13 14 public class PassArray 15 { 16 public static void main(String[] args) 17 { 18 19 final int ARRAY_SIZE = 4; //Size of the array 20 // Create...
Java Codes: 1. Create a class named Proficiency1Practice In the main method, first ask the user...
Java Codes: 1. Create a class named Proficiency1Practice In the main method, first ask the user to enter a short sentence which ends in a period. Use Java String class methods to determine the following about the sentence and display in the console: • How many total characters are in the sentence? • What is the first word of the sentence? Assume the words are separated by a space. • How many characters are in the first word of the...
This is in Java 1. Create an application called registrar that has the following classes: a....
This is in Java 1. Create an application called registrar that has the following classes: a. A student class that minimally stores the following data fields for a student:  Name  Student id number  Number of credits  Total grade points earned             And this class should also be provides the following methods:  A constructor that initializes the name and id fields  A method that returns the student name field  A method that returns the student...
1. Create a new Java project called L2 and a class named L2 2. Create a...
1. Create a new Java project called L2 and a class named L2 2. Create a second class called ArrayExaminer. 3. In the ArrayExaminer class declare the following instance variables: a. String named textFileName b. Array of 20 integers named numArray (Only do the 1st half of the declaration here: int [] numArray; ) c. Integer variable named largest d. Integer value named largestIndex 4. Add the following methods to this class: a. A constructor with one String parameter that...
This is Java class working on the eclipse. I include some of the codes just so...
This is Java class working on the eclipse. I include some of the codes just so you know what needed. create and work with interfaces you'll create the DepartmentConstants interface presented. In addition, you'll implement an interface named Displayable that's similar to the Printable interface Create the interfaces 1- Import the project named ch12-ex1_DisplayableTest and review the codes package murach.test; public interface Displayable {     String getDisplayText(); } 2 . Note that this code includes an interface named Displayable that...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT