restrictedarea

restrictedarea

//creating class for bill,generatebill,add bill,getbill

//Package cda;

import java.util.*; import java.io.*;

class BillController {

Order myorder = new Order();// CALL getOrderDetails

//Powder myPowder = new powder();//call getDetailsOfPowder //Bar myBar = new Bar();//call getDetailsOfBar

private String typeOfProduct; private double numOfProduct; private double priceOfProduct = 0; private double wtOfProduct; private double billId; private double billDate; private double totalPrice; private double totalBill; private String cover; private String packet; private String tin; private double barPrice = 0; private double giftPrice ; private double packetPowderPrice = 0; private double tinPowderPrice = 0; private double salesTax; private double octroi; private double customDuty; private double totalTax;

BillController()
{


}

//setters

 void setTypeOfProduct(String typeOfProduct)
 {
 this.typeOfProduct = typeOfProduct;
 }

 void setNumOfProduct(double numOfProduct)
 {
  this.numOfProduct = numOfProduct;
 }

 void setPriceOfProduct(double priceOfProduct)
 {
   this.priceOfProduct = priceOfProduct;
 }

 void setWtOfProduct(double wtOfProduct)
 {
   this.wtOfProduct = wtOfProduct;
 }

 void setBillId(double billId)
 {
   this.billId = billId;
 }

  void setBillDate(double billDate)
 {
   this.billDate = billDate;
 }

  void setTotalprice(double totalPrice)
  {
   this.totalPrice = totalPrice;
  }

  void setTotalBill(double totalBill)
  {
   this.totalBill = totalBill;
  }


  void setCover(String cover)
  {
   this.cover = cover;
   }

  void setPacket(String packet)
  {
   this.packet = packet;
  }

  void setTin(String tin)
  {
   this.tin = tin;
  }

  void setBarprice(double barPrice)
  {
   this.barPrice = barPrice;
  }

  void setGiftprice(double giftPrice)
  {
   this.giftPrice = giftPrice;
  }


  void setPacketPowderprice(double packetPowderPrice)
  {
   this.packetPowderPrice = packetPowderPrice;
  }

  void settinPowderprice(double tinPowderPrice)
  {
   this.tinPowderPrice = tinPowderPrice;
  }


  void setSalesTax(double salesTax)
  {
    this.salesTax = salesTax;
  }


  void setOctroi(double octroi)
  {
    this.octroi = octroi;
  }

  void setCustomDuty(double customDuty)
  {
    this.customDuty = customDuty;
  }

  void setTotalTax(double totalTax)
  {
    this.totalTax = totalTax;
  }

//getters
 String getTypeOfProduct()
 {
 return typeOfProduct;
 }

 double getNumOfProduct()
 {
  return numOfProduct;
 }

  double getPriceOfProduct()
 {
  return priceOfProduct;
 }

  double getWtOfProduct()
 {
  return wtOfProduct;
 }

   double getBillId()
 {
  return billId;
 }

   double getBillDate()
 {
  return billDate;
 }


   double getTotalPrice()
   {
    return totalPrice;
   }

   double getTotalBill()
   {
    return totalBill;
   }


   String getCover()
   {
    return cover;
   }


   String getPacket()
   {
    return packet;
   }

   String getTin()
   {
    return tin;
   }

  double getBarPrice()
   {
    return barPrice;
   }

  double getGiftPrice()
   {
    return giftPrice;
   }

   double getpacketPowderPrice()
   {
    return packetPowderPrice;
   }

   double gettinpowderprice()
   {
    return tinPowderPrice;
   }



   //getters for tax
   double getSalesTax()
   {
    return salesTax;
   }


   double getOctroi()
   {
    return octroi;
   }


   double getCustomDuty()
   {
    return customDuty;
   }


   double getTotalTax()
   {
    return totalTax;
   }


 // methods for business logic

// myorder.getOrderDetails() // { // ; // }

  // public void generateBill()
   //{
  // 
   //}

// public void calculateBill() // { // //}

   // Method for calculating Bar Price

public void barPrice(double numOfProduct,double wtOfProduct)
{
  //this.typeofproduct = typeofproduct;
     this.numOfProduct = numOfProduct;
     this.wtOfProduct = wtOfProduct;
     priceOfProduct=0;

    if(this.wtOfProduct == 10)
    {
      priceOfProduct = 10;
    }
    else if(this.wtOfProduct == 20)
    priceOfProduct = 14;
    else if(this.wtOfProduct == 30)
    priceOfProduct = 15;
    else if(this.wtOfProduct == 50)
    priceOfProduct = 18;
    else if(this.wtOfProduct == 100)
    priceOfProduct = 25;
    else if(this.wtOfProduct == 200)
    priceOfProduct = 30;       
    else
    {
    System.out.println("we didn't have this typeofproduct.choose another one");

    }

  barPrice = (this.numOfProduct) * (priceOfProduct);
  System.out.println("totalprice of " +this.numOfProduct+ " bar of " +this.wtOfProduct+ " gm is Rs " +barPrice);  
  }

//function for calculating giftbox price public void giftBoxPrice(double numOfProduct) { double giftPrice; double totalGiftPrice; this.numOfProduct = numOfProduct; giftPrice = 200; giftPrice = giftPrice * this.numOfProduct; System.out.println("total price of " +numOfProduct+" of giftbox is Rs " +giftPrice); }

//function for calculating powder priceofproduct

public void powderPrice(String cover,double wtOfProduct,double numOfProduct) { priceOfProduct = 0; this.cover = cover; this.numOfProduct = numOfProduct; this.wtOfProduct = wtOfProduct;

// calculate price of powder in packet

if(cover.equals("packet"))
  {
  if(this.wtOfProduct == 50)
    priceOfProduct = 10;
  else if(this.wtOfProduct == 80)
    priceOfProduct = 15;
  else if(this.wtOfProduct == 500)
    priceOfProduct = 25;
  else if(this.wtOfProduct == 900)
    priceOfProduct = 30;   
  else
   System.out.println("please choose between 50gm,80gm,500gm,900gm");

  packetPowderPrice = (this.numOfProduct) * (priceOfProduct);  
System.out.println("price of " +this.numOfProduct+ "  powder in " +this.cover+ " of "
                     +this.wtOfProduct+ " gm is Rs " +packetPowderPrice);
 }


// calculate price of powder in tin
 else if(cover.equals("tin"))
  {
   if(this.wtOfProduct == 50)
    priceOfProduct = 10 + (0.1 * 10);
   else if(this.wtOfProduct == 80)
    priceOfProduct = 15 + (0.1 * 15);
   else if(this.wtOfProduct == 500)
    priceOfProduct = 25 + (0.1 * 25);
   else if(this.wtOfProduct == 900)
    priceOfProduct = 30 + (0.1 * 30);
   else
   System.out.println("please choose between 50gm,80gm,500gm,900gm");
  }

else
{
 System.out.println("we don't have " +this.cover+ " option.please choose between tin & packet" );
}


tinPowderPrice = (this.numOfProduct) * (priceOfProduct);  
System.out.println("price of " +this.numOfProduct+ "  powder in " +this.cover+ " of "
                     +this.wtOfProduct+ " gm is Rs " +tinPowderPrice);

}

   public void addBill()
   {

   }

   public void getBill()
   {
   totalBill = barPrice + giftPrice + packetPowderPrice + tinPowderPrice ;
   System.out.println("Total Bill = Rs" +totalBill);
   }



    //method for calculating tax

   public void tax()
   {
     salesTax = 0.1 * totalBill;
     octroi = 0.15 * totalBill;
     customDuty = 0.2 * totalBill;
     totalTax = (salesTax) + (octroi) + (customDuty);
     System.out.println("Total tax = Rs" +totalTax);

   }

}

//-------------------------------------------------------------------------

//class BillUI {

// private double orderId; // System.out.println("Enter the order Id"); // BufferedReader orderDetails = new BufferedReader(new InputStreamReader(System.in)); // String orderId = reader.readLine();

/* public void showOrderDetails() { myOrder.getOrderDetails()

 LinkedList m1 = new LinkedList();

Iterator itr = m1.iterator(); while(itr.hasNext()) { object element = itr .next(); System.out.println(element +"\n") } System.out.println(); }*/

}

//--------------------------------------------------------------------------- /*class Bill {

barPrice = (this.numOfProduct) * (priceOfProduct);

  giftPrice  = giftPrice * this.numOfProduct;

  packetPowderPrice = (this.numOfProduct) * (priceOfProduct);

tinPowderPrice = (this.numOfProduct) * (priceOfProduct);

 totalBill = barPrice + giftPrice + packetPowderPrice + tinPowderPrice ;

}*/

/* class BillUi { System.out.println("totalprice of " +this.numOfProduct+ " bar of " +this.wtOfProduct+ " gm is Rs " +barPrice); System.out.println("total price of " +numOfProduct+" of giftbox is Rs " +giftPrice); System.out.println("price of " +this.numOfProduct+ " powder in " +this.cover+ " of " +this.wtOfProduct+ " gm is Rs " +packetPowderPrice);

System.out.println("price of " +this.numOfProduct+ " powder in " +this.cover+ " of " +this.wtOfProduct+ " gm is Rs " +tinPowderPrice); System.out.println("Total Bill = Rs" +totalBill);

} */

/* class Billcontroller {

}

*/

View Answers









Related Tutorials/Questions & Answers:
restrictedarea

Ads