Status: Started
Objective
The artist that we were working with in the previous exercise now has two types of paint cans - small (1 gallon), and large (5 gallons).
The artist wants to use their large cans before opening any of the small cans to save paint.
Write a method `enough
- Scratchpad.java
- Unit Test
Font Size
14
Parentheses autocomplete
Wrap lines
Editor
Theme
Code with blocks by default
Console Font Size
12
Console Theme
Display Server Graphics Screen
Show File Tab Bar
Debug Mode
Enough Paint 2
Unit Test
1
2
public int enoughPaintTwo(int small, int large, int total)
{
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output
Grading
Docs
Exercise
More
History
Video
Download
About
W
Test Cases
x/x
Pass | Test | Message | |
---|---|---|---|
- | Test results will show here. | - |
Errors:
This student is viewing this assignment in English. View this page in English?
5 points
The artist that we were working with in the previous exercise now has two types of paint cans - small (1 gallon), and large (5 gallons).
The artist wants to use their large cans before opening any of the small cans to save paint.
Write a method enoughPaint(int small, int large, int total)
that returns the number of small cans that the artist needs to use in order to reach the total number of gallons needed for their project. If there are not enough small cans, then the program should return -1.
For example, enoughPaint(2, 1, 7)
should return 2, and enoughPaint(1, 1, 7)
should return -1.
Reset Code
Upload an image
Upload from your computer
Or paste a link here
Slides and Notes
No slides available for this video
About
Java Practice (main)
Java Version 1.8.0_222