Question
//I'm having trouble with these three things: printing the inventory (id, brand, color, size, quantity) by categories: Women, Men, and children, Print the cost of
//I'm having trouble with these three things: printing the inventory (id, brand, color, size, quantity) by categories: Women, Men, and children, Print the cost of all the inventory, and sell items and take them out from the system.
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.EmptyStackException; import java.util.Stack;
class ItemDetails { int ID; String Color; int Size; float Price; int Quantity; ItemDetails(int ID,String Color,int Size,float Price,int Quantity) { this.ID=ID; this.Color=Color; this.Size=Size; this.Price=Price; this.Quantity=Quantity; } }
public class main {
// TODO Auto-generated method stub
public static void main(String[] args) {
int press1=0;
ArrayList stack = new ArrayList();
do {
Scanner scan =new Scanner(System.in);
System.out.println(" "+"Welcome to Old Navy");
System.out.println("Enter #1 to enter cloths mens aisle");
System.out.println("Enter #2 to enter cloths womens aisle");
System.out.println(" Enter #3 to enter cloths kids aisle");
System.out.println(" Enter #4 to see whole inventory");
System.out.println(" Enter #5 to see price of whole inventory");
System.out.println(" Enter #6 to exit");
press1= scan.nextInt();
switch (press1) {
case 1:
System.out.println(" "+ "Mens Department");
System.out.println("Shirt");
System.out.println("Enter Id");
int ID=scan.nextInt();
System.out.println("Enter Color");
String Color=scan.next();
System.out.println("Enter Size");
int Size=scan.nextInt();
System.out.println("Enter Price");
int Price=scan.nextInt();
System.out.println("Enter Quantity");
int Quantity=scan.nextInt();
ItemDetails MItem=new ItemDetails(ID,Color,Size,Price,Quantity); Stack
break;
case 2:
System.out.println(" "+ "Womens Department");
System.out.println("Shirt");
System.out.println("Enter Id");
int IDw=scan.nextInt();
System.out.println("Enter Color");
String Colorw=scan.next();
System.out.println("Enter Size");
int Sizew=scan.nextInt();
System.out.println("Enter Price");
int Pricew=scan.nextInt();
System.out.println("Enter Quantity");
int Quantityw=scan.nextInt(); ItemDetails WItem=new ItemDetails(IDw,Colorw,Sizew,Pricew,Quantityw); Stack
break;
case 3:
System.out.println(" "+ "Kids Department");
System.out.println("Shirt");
System.out.println("Enter Id");
int IDk=scan.nextInt();
System.out.println("Enter Color");
String Colork=scan.next();
System.out.println("Enter Size");
int Sizek=scan.nextInt();
System.out.println("Enter Price");
int Pricek=scan.nextInt();
System.out.println("Enter Quantity");
int Quantityk=scan.nextInt(); ItemDetails KItem=new ItemDetails(IDk,Colork,Sizek,Pricek,Quantityk); Stack
case 4:
break;
case 5:
break;
case 6:
System.out.println("Exit");
System.exit(6);
}
}while (press1 !=6);
}
}
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