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

 

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

Write a method that returns the amount of fuel remaining in your space ship after flying to Mars (hopefully!). The integer input parameter indicates how much total fuel is needed for your ship to make it all the way to Mars. The integer array indicates how much fuel is used by each stage of the rocket. If there is not enough fuel to make it to Mars, return a -1 as a flag.


jan19_2018_APSLHL_marsLaunch(45, [4, 15, 17]) → 9
jan19_2018_APSLHL_marsLaunch(12, [5, 72, 89, 121]) → -1
jan19_2018_APSLHL_marsLaunch(500, [300, 50, 150]) → 0

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

public int jan19_2018_APSLHL_marsLaunch(int netThrust, int[] stages) { }

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