Question: with java Student class : class Student{ private String first; private String last; private double grade; private static int studentNumber=0; Student(){ studentNumber++; } Student(String f,

with java
Student class :
class Student{
private String first;
private String last;
private double grade;
private static int studentNumber=0;
Student(){
studentNumber++;
}
Student(String f, String l,double g){
first=f;
last=l;
grade=g;
studentNumber++;
}
public void showStudent() {
System.out.println("Name:"+ first+ " "+ last +" Grade:"+grade);
}
public String getFirst(){
return first;
}
public void setFirst(String newFirst){
first=newFirst;
}
public static int getStudentNumber(){
return studentNumber;
}
}
public class TestStudent {
public static void main(String[] args) {
Student S1=new Student();
Student S2=new Student("Nourah","Janbi",4.8);
S1.showStudent();
S2.showStudent();
Student S3;
S3 = S2;
System.out.println("S1:"+S1);
System.out.println("S2:"+S2);
System.out.println("S3:"+S3);
S1.setFirst("Amal");
S2.setFirst("Sara");
System.out.println("s1 first name:"+S1.getFirst());
System.out.println("s2 first name:"+S2.getFirst());
System.out.println("Student number:"+Student.getStudentNumber());
}
}
with java Student class : class Student{ private String first; private String

Question 6.1: Consider the Student class with its private instance variables (Lab 5) and the following methods: 14. The constructor 1 that do nothing. 15. The getGrade method that returns the grade of one student. 16. The static showStudent method that uses a student object as parameter and displays the information of this object. a. Add the read method that reads from the keyboard the information of one student. The grade should be between 40 and 100 . 17. In the TestStudent class with main method, a. Create 3 objects S1, S2 and S3. b. Read the information of each student. c. Show the average of the grades. Question 6.2: 1. Now create a static read method in TestStudent class that creates a student object, reads the information of this object and returns it. What you should add in the Student class to write the read method? 2. How to call this method in main to read the information of the three students. 3. Show the information of each student using showStudent method. Question 6.3: 1. Now in main method, consider an array STUD of 3 students instead of S1, S2 and S3. 2. Call the read method of the TestStudent class to fill the Array of Students. 3. Modify the showStudent method to show the students with grades greater or equal to 60

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!