Skip to content

Instantly share code, notes, and snippets.

@arielmagbanua
Last active September 30, 2021 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arielmagbanua/a9bb72ff6fd56cec6835a216a36897e8 to your computer and use it in GitHub Desktop.
Save arielmagbanua/a9bb72ff6fd56cec6835a216a36897e8 to your computer and use it in GitHub Desktop.
Rice Bags

Rice Bags

Provided that you have a given number big rice bags (5 kilos each), and then display the number of bags to be used for a certain kilos of rice as an input.

Starter Code

public class App {
    public static void main(String[] args) throws Exception {
        // scanner
        Scanner scanner = new Scanner(System.in);

        // input kilograms of rice
        
        // get the character to count

        // display how many bags of rice to be used
        
        scanner.close();
    }
}

Output

Kilos of rice: 5
bags = 1
Kilos of rice: 10
bags = 2
Kilos of rice: 12.5
bags = 3
Kilos of rice: 14
bags = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment