We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public class Product{
static ArrayList< Product> list=new ArrayList();
private int id;
private String name;
private double price;
public int getId(){
return id;
}
public void setId(){
}
public String getName(){
return name;
}
public void setName(){
this.name=name;
}
public double getPrice(){
return price;
}
public void setPrice(){
this.price=price;
}
public class ProductDetails{
static ArrayList list=new ArrayList();
public static void main(String args[]){
Scanner input =new Scanner(System.in);
System.out.println("1.add product");
System.out.println("2.display product");
System.out.println("3.update product");
System.out.println("4.search product");
System.out.println("5.delete product");
System.out.println("6. exit");
System.out.println("select ur choice");
int choose=input.nextInt();
switch(choose){
case 1:
addProduct();
break;
case 2:
displayProduct();
break;
case 3:
updateProduct();
break;
case 4:
searchProduct();
break;
case 5:
deleteProduct();
break;
default: break;
}
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Welcome to Java!
You are viewing a single comment's thread. Return to all comments →
import java.util.ArrayList; import java.utilScanner;
public class Product{ static ArrayList< Product> list=new ArrayList(); private int id; private String name; private double price;
public class ProductDetails{ static ArrayList list=new ArrayList();
public static void main(String args[]){ Scanner input =new Scanner(System.in); System.out.println("1.add product"); System.out.println("2.display product"); System.out.println("3.update product"); System.out.println("4.search product"); System.out.println("5.delete product"); System.out.println("6. exit"); System.out.println("select ur choice"); int choose=input.nextInt(); switch(choose){ case 1: addProduct(); break; case 2: displayProduct(); break; case 3: updateProduct(); break; case 4: searchProduct(); break;
case 5: deleteProduct(); break;
default: break; } } }