Question: Program : GpaTestEx2.java Coding: import java.util.Scanner; public class GpaTestEx2 { public static void main (String[] args) { //declarations Scanner in = new Scanner(System.in); //input object

 Program : GpaTestEx2.java Coding: import java.util.Scanner; public class GpaTestEx2 { publicstatic void main (String[] args) { //declarations Scanner in = new Scanner(System.in);//input object int numCourses; /umber of courses - can be changed intcredits; /umber of credits for a course String grade; //grade for course//read in number of courses System.out.print("Enter number of courses: "); numCourses =

Program : GpaTestEx2.java

Coding:

import java.util.Scanner; public class GpaTestEx2 { public static void main (String[] args) { //declarations Scanner in = new Scanner(System.in); //input object int numCourses; /umber of courses - can be changed int credits; /umber of credits for a course String grade; //grade for course //read in number of courses System.out.print("Enter number of courses: "); numCourses = in.nextInt(); //create Gpa object to hold specified number of courses Gpa myGPA = new Gpa(numCourses); //read in all courses and add course information to Gpa object for (int k=0; k

Exercise 1- GPA calculation using arrays (3 points) The exercise must be completed during the lab period. This lab requires the development of a java program to calculate the standard grade point average (GPA) for a student at RIT. The program will prompt the user to enter the credits and letter grade for each of exactly 4 courses. The GPA is calculated by dividing the sum of points times credits by the sum of credits. To compute the sum of points, the letter grade must be converted to its equivalent number of points as follows: A is 4 points, B is 3 points, C is 2 points, D is 1 point, and F is O points. Then multiply the points by the number of credits and sum for the 4 courses. For example, if a student scores C in a 3-credit course, B in a 4-credit course, D in a 4-credit course, and A in a 3- credit course, the calculation would go as follows: Sum of credits -3+4+ 4+3- 14 Sum of points times credits-3 * 2 (-C) 4 * 3 (-B) + 4 * 1 (D) + 3 * 4 (A)-34 GPA 34/14 2.42857... 2.43 (rounded to 2 decimal places. After the user enters the credits and letter grade for all four courses, print the sum of the credits for all four courses, the sum of the points times credits for all four courses and the GPA for all four courses. For Exercise 1, write all of the code in the main method. Store the credits for each course in an array with 4 elements. Store the letter grades in another array with 4 elements. When computing the sum of the credits, an enhanced for loop must be used. This exercise uses "parallel" arrays; i.e. a data element in one array is matched to a related data element in the other array using the same index value. A constant must be defined and used for the number of courses. Also, in Exercise 1, write a method: which, given a letter grade, returns the appropriate numeric grade. In Exercise 2, develop a Gpa class using "paralle" arrays to hold the grades and credits. lin public double letterToNumeric(char letterGrade) Exercise 3, develop a Gpa class using an ArrayList to hold the course information

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!