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

 

mmiller@cacegypt.org > dinner
prev  |  next  |  chance

Emmy eats spinach and string beans on alternate nights, except on Saturdays when she eats both. Days are numbered: Sunday = 0, Monday = 1, and so on. Ms. Delaney says "use the 'return X' statement to return the correct meal item as a string, in place of 'X'." [HINT: the % (mod) operator returns the remainder of a division. For example: 5%2 = 1. 8%2 = 0.]


dinner(0) → "spinach"
dinner(1) → "string beans"
dinner(2) → "spinach"

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

public String dinner( int dayOfWeek ){ }

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: 105 Post-solution available

Copyright Nick Parlante 2017 - privacy