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

 

jebbert@volusia.k12.fl.us > finalExam2014rollUps
prev  |  next  |  chance

Write a method that accepts an array of integers representing grade levels of high school students at DHS at the end of the year, and a string with "P" or "F" in each position corresponding to the grade levels in the array. Roll up each student to their next grade level if their corresponding position in the string is "P" (indicating they passed). An "F" in the string represents failing, in which case the student stays at the same grade level. Anything else in the string generates an error code of -1 for the student's new grade level. 12th grade students who pass get to graduate which is represented by a zero. Note that the array of grade levels will have the same number of elements as the length of the string that indicates pass/fail. Return the array of new grade levels after the roll-ups.


finalExam2014rollUps([], "") → []
finalExam2014rollUps([9, 10, 11, 12], "PPPP") → [10, 11, 12, 0]
finalExam2014rollUps([11, 12, 9, 10, 9, 10], "PPPPPP") → [12, 0, 10, 11, 10, 11]

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

public int[] finalExam2014rollUps(int[] gradeLevels, String pass) { }

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: 280

Copyright Nick Parlante 2017 - privacy