Question
As I was on a hike the other day I came across a small child in the woods. He told me his life story, with
As I was on a hike the other day I came across a small child in the woods. He told me his life story, with special mention of his disabled sister who loves flowers, and asked me for a favor.
He wanted a way to organize the flowers that he picks for her each day and perform a few basic tasks with them, along with a few restrictions. It is our goal to help him out!
He can only carry 25 flowers as adding any more causes many of them to become crushed.
All flowers should be able to be displayed
He should be able to add and remove flowers by using their name.
He needs to be able to search for a specific type of flower in his pack in case his sister has a special request.
He needs to be able to sort flowers by their names alphabetically in ascending order (A-Z)
He needs to show how many of each flower he has in his pack.
Now, I have started a simple program which will serve as guidance for you, please help me finish it. (Please dont modify the code that I give you, just add your code where required)
Submit 1 file: Assignment1.java
import java.util.Scanner;
public class Assignment01Driver {
public static void main(String[] args){
new Assignment01Driver ();
}
// This will act as our program switchboard
public Assignment01Driver (){
Scanner input = new Scanner(System.in);
String[] flowerPack = new String[25];
System.out.println("Welcome to my flower pack interface.");
System.out.println("Please select a number from the options below");
System.out.println("");
while(true){
// Give the user a list of their options
System.out.println("1: Add an item to the pack.");
System.out.println("2: Remove an item from the pack.");
System.out.println("3: Sort the contents of the pack.");
System.out.println("4: Search for a flower.");
System.out.println("5: Display the flowers in the pack.");
System.out.println("0: Exit the flower pack interfact.");
// Get the user input
int userChoice = input.nextInt();
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started