Question: Complete the following code segment such that your implementation of class Student supports the operations used in the main method. Sample runs Input 1: Tim

Complete the following code segment such that your implementation of class Student supports the operations used in the main method. Sample runs Input 1:

Tim CS 30 3.5 3 A 

Output 1:

3.55

Input 2:

James Math 10 4 4 B 

Output 2:

3.71

// TEST

import java.util.Scanner; // your code starts here

// your code ends here public class Test { public static void main(String[] args) { Scanner stdin = new Scanner(System.in);

String name = stdin.nextLine(); String major = stdin.nextLine(); double hours = stdin.nextDouble(); double gpa = stdin.nextDouble();

Student student = new Student(name, major, hours, gpa); double creditHours = stdin.nextDouble(); String grade = stdin.next();

student.addGrade(creditHours, grade);

// print the new GPA System.out.printf("%.2f", student.getGpa());

} }

// STUDENT

package student; // your code starts here

// your code ends here

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!