Solution4
package pone;
import java.util.*;
class Orders
{
private int orderId;
private String orderName;
private int noOfProducts;
private ArrayList<String> products;
private ArrayList<Integer> quantities;
public Orders(int orderId,String orderName,int noOfProducts,ArrayList<String> products,ArrayList<Integer> quantities)
{
this.orderId = orderId;
this.orderName = orderName;
this.noOfProducts = noOfProducts;
this.products = products;
this.quantities = quantities;
}
public int getOrderId() {
return orderId;
}
public Orders setOrderId(int orderId) {
this.orderId = orderId;
return this;
}
public String getOrderName() {
return orderName;
}
public Orders setOrderName(String orderName) {
this.orderName = orderName;
return this;
}
public int getNoOfProducts() {
return noOfProducts;
}
public Orders setNoOfProducts(int noOfProducts) {
this.noOfProducts = noOfProducts;
return this;
}
public ArrayList<String> getProducts() {
return products;
}
public Orders setProducts(ArrayList<String> products) {
this.products = products;
return this;
}
public ArrayList<Integer> getQuantities() {
return quantities;
}
public Orders setQuantities(ArrayList<Integer> quantities) {
this.quantities = quantities;
return this;
}
}
public class Solution4
{
//Find the product having maximum quantity
public void task1(ArrayList<Orders> ord,int input1)
{
int count = 0;
for(Orders or : ord)
{
if(or.getOrderId() == input1)
{
}
}
}
//Find Orders by Product Name
public void task2(String input2)
{
}
public static void main(String[] args)
{
Scanner xx = new Scanner(System.in);
Solution4 yy = new Solution4();
int n = xx.nextInt();xx.nextLine();
ArrayList<Orders> ord = new ArrayList<>();
for(int i = 0;i < n; i++)
{
int orderId = xx.nextInt();xx.nextLine();
String orderName = xx.nextLine();
//int noOfProducts = xx.nextInt();
int m = xx.nextInt();xx.nextLine();
ArrayList<String> prod = new ArrayList<>();
for(int j = 0; j < m; j++)
{
String prodname = xx.nextLine();
prod.add(prodname);
}
int o = xx.nextInt();xx.nextLine();
ArrayList<Integer> quant = new ArrayList<>();
for(int k = 0; k < o; k++)
{
int quatnum = xx.nextInt();xx.nextLine();
quant.add(quatnum);
}
ord.add(new Orders(orderId,orderName,m,prod,quant));
}
int input1 = xx.nextInt();xx.nextLine();
String input2 = xx.nextLine();
yy.task1(ord,input1);
yy.task2(input2);
}
}
Comments
Post a Comment