Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package spring17;
- public class Customer {
- String name;
- int age;
- String loginid;
- String cell;
- String email;
- String Password;
- String CustomerId;
- public Customer(String name,int age,String loginid,String cell, String email, String Password, String CustomerId) {
- this.name = name;
- this.age = age;
- this.loginid=loginid;
- this.cell = cell;
- this.email = email;
- this.Password = Password;
- this.CustomerId=CustomerId;
- }
- }
- package spring17;
- /**
- *
- * @author sajib
- */
- public class BuyItem {
- String Pid;
- String Pname;
- double Qyt;
- double price;
- String Pid1;
- String Pname1;
- double Qyt1;
- double price1;
- double totalprice;
- public BuyItem(String Pid, String Pname, double Qyt, double price, String Pid1, String Pname1, double Qyt1, double price1,double t) {
- this.Pid = Pid;
- this.Pname = Pname;
- this.Qyt = Qyt;
- this.price = price;
- this.Pid1 = Pid1;
- this.Pname1 = Pname1;
- this.Qyt1 = Qyt1;
- this.price1 = price1;
- totalprice=t;
- }
- }
- package spring17;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args)
- {
- Scanner input=new Scanner(System.in);
- Customer []obj=new Customer[1];
- BuyItem []obj1=new BuyItem[1];
- int i;
- for( i=0;i<1;i++)
- {
- System.out.println("Input Name");
- String Name=input.nextLine();
- System.out.println("Input Age");
- int Age=input.nextInt();
- System.out.println("Input login id");
- input.nextLine();
- String login=input.nextLine();
- System.out.println("Input Phone number");
- String cell=input.nextLine();
- System.out.println("Input email");
- String email=input.nextLine();
- System.out.println("Password");
- String password=input.nextLine();
- System.out.println("CustomerId");
- String Cid=input.nextLine();
- System.out.println("product Id");
- String Pid=input.nextLine();
- System.out.println("Product name");
- String Pname=input.nextLine();
- System.out.println("Qty");
- double Qty=input.nextDouble();
- System.out.println("Price");
- double price=input.nextDouble();
- input.nextLine();
- System.out.println("Product Id");
- String Pid1=input.nextLine();
- System.out.println("Product Name");
- String Pname1=input.nextLine();
- System.out.println("Qty");
- double Qty1=input.nextDouble();
- System.out.println("Price");
- double price1=input.nextDouble();
- obj[i]=new Customer(Name,Age,login,cell,email,password,Cid);
- obj1[i]=new BuyItem(Pid,Pname,Qty,price,Pid1,Pname1,Qty1,price1,price+price1);
- System.out.println("Customer Details");
- System.out.println("-----------------");
- System.out.println("Name :"+obj[i].name+"\tAge :"+obj[i].age+"\tLoginId :"+obj[i].loginid);
- System.out.println("Cell :"+obj[i].cell+"\temail :"+obj[i].email+"\tPassword :"+obj[i].Password);
- System.out.println("Customer Id :"+obj[i].CustomerId);
- System.out.println("Item Purchased");
- System.out.println("---------------");
- System.out.println("Item Id :"+obj1[i].Pid+"\tName :"+obj1[i].Pname+"\tQty :"+obj1[i].Qyt+"\tPrice :"+obj1[i].price);
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement