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

 

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

Write a method that determines the minimum score needed within a grading category in order to reach a desired overall score for that category. There are several input parameters: 'earned' is the number of points you have already earned in that grading category. 'possible' is the total possible points in that category so far, not including the new points. 'newPoints' are the new points in that category. This is the new graded item. 'desiredScore' is your overall minimum desired score in that grading category. So your goal is to find the minimum score needed on that new assignment (based on 'newPoints') in order to earn the 'desiredScore'. However, there are some special cases: If you will reach the desired score no matter what you earn on the new assignment, return zero. If you need to earn more points than are possible, still report that value since bonus points may be available. For example, if you need 70 points on a 50 point assignment, you would return 70. Of course it may not be possible to earn that many bonus points, but at least the student will know where he or she stands.


feb27_2018_SLHL_grAid(500, 550, 100, 90) → 85
feb27_2018_SLHL_grAid(400, 1000, 200, 90) → 680
feb27_2018_SLHL_grAid(1000, 1000, 50, 70) → 0

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

public int feb27_2018_SLHL_grAid(int earned, int possible, int newPoints, int desiredScore) { }

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

Copyright Nick Parlante 2017 - privacy