Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: At the end of the exercise, the students should be able to: Implement stacks in both Java and Python. . . Software Requirements: NetBeans

image text in transcribed

Objective: At the end of the exercise, the students should be able to: Implement stacks in both Java and Python. . . Software Requirements: NetBeans IDE Java Development Kit (JDK) 8 Python 3.7 or higher Procedure: 1. Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark) 2. Using NetBeans, create a Java project named FruitBasket. Set the project location to your own folder. 3. Import Scanner and Stacks from the java.util package. 4. Create a Stack object named basket. 5. The output shall: 5.1. Ask the user to input the number of fruits s/he would like to catch. 5.2. Ask the user to choose a fruit to catch by pressing A for apple, O for orange, M for mango, or G for guava. 5.3. Display all the fruits that the basket has. 5.4. Ask the user to enter E to start eating a fruit. 5.5. Display the fruits remaining each time E is entered and "No more fruits" when the basket becomes empty. 6. 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") 7. Save the script as fruit_basket.py to your folder. See sample output for Python on the next page

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB 2008 Databases

Authors: Vidya Vrat Agarwal, James Huddleston

1st Edition

1590599470, 978-1590599471

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago