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

 

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

Write a method that returns the calories present in a plate of food. Parameters mainDish, sauce, and side will contain the number of calories each of these parts of the dish has. Some customers might not want all of the parts of the dish. Only include the sauce if useSauce is true. Only include the side if useSide is true. Return the total calorie count for the entire dish.


foodCalorieCount(500, 100, 200, true, true) → 800
foodCalorieCount(500, 100, 200, false, true) → 700
foodCalorieCount(500, 100, 200, true, false) → 600

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

public int foodCalorieCount(int mainDish, int sauce, int side, boolean useSauce, boolean useSide) { }

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

Copyright Nick Parlante 2017 - privacy