Question
An academic advisor wants a program that will compute a student GPA by reading a file that contains the name of the courses taken, credit
An academic advisor wants a program that will compute a student GPA by reading a file that contains the name of the courses taken, credit hours for each course, and grades earned from each course. The program will take, as run-time parameters, the folder directory where the grades file is stored and the first and last name of the student. For this testing your program, use the posted grades file called grade/Irving-Whitewood.cvs To complete this assignment, we will use class Student.java completed from Chapter 10. The purpose for this is to reuse functionality we have already created. Create a new java file, called MyStudent.java that inherits from the Student class. Inside this new file, do the following: 1. Static properties and behaviors a. Create a private static ArrayList of courses private static ArrayList courseList; b. A public static method to add to the ArrayList public static void addCourse(String courseName, int creditHours, char letterGrade); You need to implement code that creates a Course object and adds that object to the courseList. 3. Non-static properties and behaviors a. Create a public constructor that takes two Strings public MyStudent(String fname, String lname); (implementation details explained below): i. Determine the number of courses from the size of the courseList. ii. Call super(fname, lname, numberOfCourses) b. A public method to compute GPA use the String toString() method (implementation details explained below): i. For each element in courseList 1. get courseName, creditHours, and letterGrade from the element 2. Call super.createCourse(courseName, creditHours, letterGrade) to create a course ii. return super.toString() to get the output Inside your ComputeStudentGPAProgram.java, write a main method that serves as the main launching code. This program will read the file (grade/Irving-Whitewood.cvs) that contains the grades for a student and the first and last name of the student. The program determines the GPA for the student. Here, you will read the csv file (grade/Irving-Whitewood.cvs) to determine the students GPA. For each line in the file, you will need store this information by calling method addCourse() from class MyStudent. Once you have completed reading the file, close the file, and then proceed to do the following: invoke the toString() method of this object inside a System.out.println statement The output of your code will be: Output: Student {firstname}, {lastname} has a {GPA value} GPA Example: John Doe has a 3.4 GPA NOTE You will be provided with a file grade/Irving-Whitewood.cvs. Note that you cannot hardcode the first name and last name into your program directly. Your program MUST read the filename during the code execution. The structure of file Irving-Whitewood.cvs is: CourseName1,creditHours,grade CourseName2,creditHours,grade CourseName3,creditHours,grade
Irving-Whitewood.cvs file below
Calculus | 4 | A |
Physics | 4 | A |
Computer Science | 4 | B |
English | 3 | C |
AmericanHistory | 2 | B |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started