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

 

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

Write a method that accepts a string called fruit, containing the name of a type of fruit; an integer called cost contains the number of whole dollars it costs for someone to buy that fruit from you. The variable numSold tells how many of those fruit were sold. Please look carefully at the sample data for examples.


fruitStand("orange", 2, 11) → "You sold 11 oranges at $2 each, for a total of $22."
fruitStand("date", 4, 50) → "You sold 50 dates at $4 each, for a total of $200."
fruitStand("x", 30, 30) → "You sold 30 xs at $30 each, for a total of $900."

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

public String fruitStand(String fruit, int cost, int numSold) { }

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