id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

abraskin@mbusd.org > calcGPA
prev  |  next  |  chance

Some schools give an extra bonus to the grade received in AP classes.
You will write a method that will calculate a student's GPA as either weighted or unweighted depending on the parameter: isWeighted
But not all classes are AP classes so the students grades are stored in two parallel arrays:
The first array, grades contains the letter grade which translates as follows:

A - 4 points
B - 3 points
C - 2 points
D - 1 point
F - 0 points
Grades may include a + or - but it is ignored!
The second array, isAP is true if the class is an AP class.
If a class is an AP class then an extra 1 point is added to the grade's point value if the grade is a C or better.

calcGPA(false, ["A-", "A+", "A"], [true, true, true]) → 4.0
calcGPA(true, ["A-", "A+", "A"], [true, true, true]) → 5.0
calcGPA(false, ["F", "C+", "B", "A-"], [false, false, false, true]) → 2.25

...Save, Compile, Run (ctrl-enter)

public double calcGPA(boolean isWeighted, String[] grades, boolean[] isAP) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy