CSC 275 Assignment 2 Flower Pack

Availability: In stock

Regular Price: $20.00

Special Price: $15.00

OR

CSC 275 Assignment 2 Flower Pack

Double click on above image to view full picture

Zoom Out
Zoom In

More Views

Quick Overview

CSC 275 Assignment 2 Flower Pack


Now that we've helped out our friend and his sister they have invited us over for dinner to talk about what improvements can be made. We find out many things about the young boy, we even find out that his name is Alexander and his sister’s name is Elizabeth. Elizabeth tells us a about the day of her accident when she was climbing a tree and a branch broke causing her to fall to the ground giving her these near fatal wounds leaving her bed-ridden. Finally, we start talking about the improvements they would like made to make Elizabeth’s life a little happier.
Alexander finds himself searching through his pack for specific traits of a flower. Some days Elizabeth wants only red flowers or only flowers with thorns as she likes to peel them off. Surely we can help them out!
• Create a flower object that has specific traits (name, color, presence of thorns and smell)
• These flower objects must be able to stay in his pack (Use an array of length 25)
• Be able to add, remove and search these flowers – by name and traits (We can drop the sorting for now)


Using the same code as assignment 1 you can make your changes. I have included some base code for your convenience (This is 2 classes, Assignment2 and Flower).
import java.util.Scanner;
public class Assignment2 {
public static void main(String[] args) {
new Assignment2();
}
// This will act as our program switchboard
public Assignment2() {
Scanner input = new Scanner(System.in);
Flower[] flowerPack = new Flower[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: Search for a flower.");
System.out.println("4: Display the flowers in the pack.");
System.out.println("0: Exit the flower pack interfact.");
// Get the user input
int userChoice = input.nextInt();
switch (userChoice) {
case 1:
addFlower(flowerPack);
break;
case 2:
removeFlower(flowerPack);
break;
case 3:
searchFlowers(flowerPack);
break;
case 4:
displayFlowers(flowerPack);
break;
case 0:
System.out
.println("Thank you for using the flower pack interface. See you again soon!");
System.exit(0);
}
}
}


private void addFlower(Flower flowerPack[]) {
// TODO: Add a flower that is specified by the user
}


private void removeFlower(Flower flowerPack[]) {
// TODO: Remove a flower that is specified by the user
}


private void searchFlowers(Flower flowerPack[]) {
// TODO: Search for a user specified flower
}


private void displayFlowers(Flower flowerPack[]) {
// TODO: Display only the unique flowers along with a count of any
// duplicates
/*
* For example it should say Roses - 7 Daffodils - 3 Violets - 5
*/
}
}


// This should be in its own file
public class Flower {
// Declare attributes here
public Flower(){
}
// Create an overridden constructor here
//Create accessors and mutators for your traits.
}

Regular Price: $20.00

Special Price: $15.00

Details

CSC 275 Assignment 2 Flower Pack

Now that we've helped out our friend and his sister they have invited us over for dinner to talk about what improvements can be made. We find out many things about the young boy, we even find out that his name is Alexander and his sister’s name is Elizabeth. Elizabeth tells us a about the day of her accident when she was climbing a tree and a branch broke causing her to fall to the ground giving her these near fatal wounds leaving her bed-ridden. Finally, we start talking about the improvements they would like made to make Elizabeth’s life a little happier.
Alexander finds himself searching through his pack for specific traits of a flower. Some days Elizabeth wants only red flowers or only flowers with thorns as she likes to peel them off. Surely we can help them out!
• Create a flower object that has specific traits (name, color, presence of thorns and smell)
• These flower objects must be able to stay in his pack (Use an array of length 25)
• Be able to add, remove and search these flowers – by name and traits (We can drop the sorting for now)

Using the same code as assignment 1 you can make your changes. I have included some base code for your convenience (This is 2 classes, Assignment2 and Flower).
import java.util.Scanner;
public class Assignment2 {
public static void main(String[] args) {
new Assignment2();
}
// This will act as our program switchboard
public Assignment2() {
Scanner input = new Scanner(System.in);
Flower[] flowerPack = new Flower[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: Search for a flower.");
System.out.println("4: Display the flowers in the pack.");
System.out.println("0: Exit the flower pack interfact.");
// Get the user input
int userChoice = input.nextInt();
switch (userChoice) {
case 1:
addFlower(flowerPack);
break;
case 2:
removeFlower(flowerPack);
break;
case 3:
searchFlowers(flowerPack);
break;
case 4:
displayFlowers(flowerPack);
break;
case 0:
System.out
.println("Thank you for using the flower pack interface. See you again soon!");
System.exit(0);
}
}
}

private void addFlower(Flower flowerPack[]) {
// TODO: Add a flower that is specified by the user
}

private void removeFlower(Flower flowerPack[]) {
// TODO: Remove a flower that is specified by the user
}

private void searchFlowers(Flower flowerPack[]) {
// TODO: Search for a user specified flower
}

private void displayFlowers(Flower flowerPack[]) {
// TODO: Display only the unique flowers along with a count of any
// duplicates
/*
* For example it should say Roses - 7 Daffodils - 3 Violets - 5
*/
}
}

// This should be in its own file
public class Flower {
// Declare attributes here
public Flower(){
}
// Create an overridden constructor here
//Create accessors and mutators for your traits.
}

Product Tags

Use spaces to separate tags. Use single quotes (') for phrases.