Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

I need help putting the codes together to make a functioning program in Netbeans and doing api FOR THE JAVADOC

1 answer below »
class SteppingStone5_Recipe {
private String recipeName;
private int cookingTime;
public SteppingStone5_Recipe(String recipeName, int cookingTime) {
super();
this.recipeName = recipeName;
this.cookingTime = cookingTime;
}
public int getCookingTime() {
eturn cookingTime;
}
public void setRacipeName(String recipeName) {
this.recipeName = recipeName;
}
public void printRecipe() {
System.out.println(recipeName+" cooked in "+ cookingTime+" hour");
}
public String getRecipeName() {
eturn recipeName;
}
}
public class SteppingStone6_RecipeBox {
private static A
ayList recipes;
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
ecipes = new A
ayList
();
int choice;
do {
menu();
choice = scan.nextInt();
switch (choice) {
case 1:
addRecipe();
eak;
case 2:
printAllRecipeDetail();
eak;
case 3:
printAllRecipeNames();
eak;
case 4:
eak;
default:
System.out.println("Invalid choice! Try Again...");
eak;
}
} while (choice != 4);
}
private static void printAllRecipeNames() {
for (SteppingStone5_Recipe steppingStone5_Recipe : recipes) {
System.out.println(steppingStone5_Recipe.getRecipeName());
}
}
private static void printAllRecipeDetail() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter recipe name: ");
String recipeName = scanner.nextLine();
int flag = 0;
for (SteppingStone5_Recipe steppingStone5_Recipe : recipes) {
if(steppingStone5_Recipe.getRecipeName().equalsIgnoreCase(recipeName)) {
steppingStone5_Recipe.printRecipe();
flag = 1;
}
}
if (flag ==0) {
System.out.println("No Recipe found!");
}
}
private static void addRecipe() {
Scanner scan = new Scanner(System.in);
System.out.print("Enter Recipe name: ");
String recipeName = scan.nextLine();
System.out.print("Enter cooking time: ");
int cookingTime = scan.nextInt();
ecipes.add(new SteppingStone5_Recipe(recipeName,cookingTime));
}
public static void menu() {
System.out.println("Menu\n" + "1. Add Recipe\n" + "2. Print All Recipe Details\n"
+ "3. Print All Recipe Names\n"+"4. Exit\n" + "\nPlease select a menu item:");
}
}

IT 511 Final Project Guidelines and Ru
ic
Answered 1 days After Aug 04, 2022

Solution

Aditya answered on Aug 06 2022
63 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here