Advertisement
Sajib_Ahmed

Untitled

Apr 14th, 2019
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.11 KB | None | 0 0
  1.  
  2. package spring17;
  3.  
  4.  
  5. public class Customer {
  6.  
  7.    
  8.    
  9.     String name;
  10.     int age;
  11.     String loginid;
  12.     String cell;
  13.     String email;
  14.     String Password;
  15.     String CustomerId;
  16.  
  17.     public Customer(String name,int age,String loginid,String cell, String email, String Password, String CustomerId) {
  18.         this.name = name;
  19.         this.age = age;
  20.         this.loginid=loginid;
  21.         this.cell = cell;
  22.         this.email = email;
  23.         this.Password = Password;
  24.         this.CustomerId=CustomerId;
  25.     }
  26.    
  27.      
  28.  
  29.    
  30. }
  31.  
  32. package spring17;
  33.  
  34. /**
  35.  *
  36.  * @author sajib
  37.  */
  38. public class BuyItem {
  39.    
  40.     String Pid;
  41.     String Pname;
  42.     double Qyt;
  43.     double price;
  44.     String Pid1;
  45.     String Pname1;
  46.     double Qyt1;
  47.     double price1;
  48.     double totalprice;
  49.  
  50.     public BuyItem(String Pid, String Pname, double Qyt, double price, String Pid1, String Pname1, double Qyt1, double price1,double t) {
  51.         this.Pid = Pid;
  52.         this.Pname = Pname;
  53.         this.Qyt = Qyt;
  54.         this.price = price;
  55.         this.Pid1 = Pid1;
  56.         this.Pname1 = Pname1;
  57.         this.Qyt1 = Qyt1;
  58.         this.price1 = price1;
  59.         totalprice=t;
  60.     }
  61.    
  62.                                            
  63.    
  64.    
  65. }
  66.  
  67. package spring17;
  68.  
  69. import java.util.Scanner;
  70. public class Main {
  71.     public static void main(String[] args)
  72.     {
  73.         Scanner input=new Scanner(System.in);
  74.         Customer []obj=new Customer[1];
  75.        
  76.      BuyItem []obj1=new BuyItem[1];
  77.         int i;
  78.        
  79.         for( i=0;i<1;i++)
  80.         {
  81.          
  82.             System.out.println("Input Name");
  83.             String Name=input.nextLine();
  84.             System.out.println("Input Age");
  85.             int Age=input.nextInt();
  86.        
  87.             System.out.println("Input login id");
  88.             input.nextLine();
  89.             String login=input.nextLine();
  90.             System.out.println("Input Phone number");
  91.             String cell=input.nextLine();
  92.             System.out.println("Input email");
  93.             String email=input.nextLine();
  94.             System.out.println("Password");
  95.             String password=input.nextLine();
  96.             System.out.println("CustomerId");
  97.             String Cid=input.nextLine();
  98.            
  99.            
  100.             System.out.println("product Id");
  101.             String Pid=input.nextLine();
  102.             System.out.println("Product name");
  103.             String Pname=input.nextLine();
  104.             System.out.println("Qty");
  105.             double Qty=input.nextDouble();
  106.             System.out.println("Price");
  107.             double price=input.nextDouble();
  108.             input.nextLine();
  109.             System.out.println("Product Id");
  110.             String Pid1=input.nextLine();
  111.             System.out.println("Product Name");
  112.             String Pname1=input.nextLine();
  113.             System.out.println("Qty");
  114.             double Qty1=input.nextDouble();
  115.             System.out.println("Price");
  116.             double price1=input.nextDouble();
  117.            
  118.            
  119.             obj[i]=new Customer(Name,Age,login,cell,email,password,Cid);
  120.             obj1[i]=new BuyItem(Pid,Pname,Qty,price,Pid1,Pname1,Qty1,price1,price+price1);
  121.          
  122.             System.out.println("Customer Details");
  123.             System.out.println("-----------------");
  124.            
  125.             System.out.println("Name :"+obj[i].name+"\tAge   :"+obj[i].age+"\tLoginId    :"+obj[i].loginid);
  126.             System.out.println("Cell :"+obj[i].cell+"\temail :"+obj[i].email+"\tPassword :"+obj[i].Password);
  127.             System.out.println("Customer Id :"+obj[i].CustomerId);
  128.            
  129.             System.out.println("Item Purchased");
  130.             System.out.println("---------------");
  131.             System.out.println("Item Id :"+obj1[i].Pid+"\tName :"+obj1[i].Pname+"\tQty :"+obj1[i].Qyt+"\tPrice :"+obj1[i].price);
  132.             System.out.println("Item Id :"+obj1[i].Pid1+"\tName :"+obj1[i].Pname1+"\tQty :"+obj1[i].Qyt1+"\tPrice :"+obj1[i].price1+"\tTotal Price :"+obj1[i].totalprice);
  133.         }
  134.     }
  135.    
  136.    
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement