nickichann01 / Fruit-Basket

Languages used Java and Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fruit-Basket

Languages used Java and Python

Instructions

- Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark)
- Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder.
- Import Scanner and Stacks from the java.util package.
- Create a Stack object named basket.

- The output shall:
     > Ask the user to input the number of fruits s/he would like to catch.
     > Ask the user to choose a fruit to catch by pressing A for apple, O for orange, M for mango, or G for guava.
     > Display all the fruits that the basket has.
     > Ask the user to enter E to start eating a fruit. 
     > Display the fruits remaining each time E is entered and "No more fruits" when the basket becomes empty.

- Convert your code into a Python script. Use the range() function to allow the user to input multiple
  times. For example, if the user has to enter input five (5) times, the code will be for i in range(5).

    The variable i represents numbers 1 to 5. Since the user input is only a one-character string, refer
    to the sample code below to add a fruit to the basket. The variable i represents all the one-character
    strings entered by the user. The functions upper() and lower() allow case-insensitive input.
    for i in keys:
                                  if i.upper() == "A":
                                  basket.append("apple")

- Save the script as fruit_basket.py to your folder.

About

Languages used Java and Python


Languages

Language:Java 66.0%Language:Python 34.0%