Commit ae9b2b8c authored by SAURABH GUPTA's avatar SAURABH GUPTA

Show Orders fucntion added

parent f8b3251f
...@@ -21,16 +21,27 @@ class Orders{ ...@@ -21,16 +21,27 @@ class Orders{
int qty; int qty;
String cust_ID; String cust_ID;
public void read(Orders O) public void read()
{ {
Scanner s = new Scanner(System.in); Scanner s = new Scanner(System.in);
this.ord_ID = s.next(); this.ord_ID = s.next();
this.type = s.next(); this.type = s.next();
this.product = s.nextLine(); this.product = s.next();
this.pro_ID = s.nextLine(); this.pro_ID = s.next();
this.price = s.nextInt(); this.price = s.nextInt();
this.qty = s.nextInt(); this.qty = s.nextInt();
this.cust_ID = s.nextLine(); this.cust_ID = s.next();
}
public void show()
{
System.out.println("OrderID :" + this.ord_ID + "\n" );
System.out.println("Type :" + this.type + "\n" );
System.out.println("Product :" + this.product + "\n" );
System.out.println("ProductID :" + this.pro_ID + "\n" );
System.out.println("Price :" + this.price + "\n" );
System.out.println("Quantity :" + this.qty + "\n" );
System.out.println("CustomerID :" + this.cust_ID + "\n" );
} }
} }
public class Main { public class Main {
...@@ -40,7 +51,11 @@ public class Main { ...@@ -40,7 +51,11 @@ public class Main {
*/ */
public static void main(String[] args) { public static void main(String[] args) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Orders O1; Orders O1 = new Orders();
System.out.println("Provide Order Details : \n [orderID : Type : Product : ProductID : Price : Quantity : CustID]\n");
O1.read();
System.out.println("These are details of your order: \n");
O1.show();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment