title: java:29: error: cost has private access in RetailItem
body: <p>Alright so I need help here I created a cash register java file and a retailItem file in my cash register file it cant read a section i put in retailItem because its private. So my question is how do i access that private variable that i wrote in my retailItem class into the cash register file </p>
  
  <p>So here's my code for retailItem</p>
  
  <pre><code>import java.text.DecimalFormat;
  public class RetailItem
  {
   private String description;
   private double price;
   private double unitsOnHand;
   private CostData cost;
  
  
  public void setDescription(String userDescription)
  { 
    description = userDescription;
  
  }
  
  public void setPrice(double p)
  {
    price = p;
  }
  
  
  public void setUnitsOnHand(double userUnitsOnHand)
  { 
    unitsOnHand = userUnitsOnHand;
  
  }
  
  public String getDescription()
  {
    return description;
  }
  public double getPrice()
  {
    return price;
  }
  
  public double getUnitsOnHand()
  {
    return unitsOnHand;
  }
  
  
  
   public RetailItem(RetailItem object2)
   {
    description = object2.description;
    price = object2.price;
    unitsOnHand = object2.unitsOnHand;
    cost = new CostData(object2.cost.wholeSale,object2.cost.Retail);
   }
  
  
  
  public RetailItem( String descriptionGet,double pri, double 
  unitsOnHandGet,double wholeSale,double retail)
  {  
    description = descriptionGet;
    price = pri;
    unitsOnHand = unitsOnHandGet;
    cost = new CostData(wholeSale,retail);
  }
  
  
  public String toString()
  {
    String str;
  
    DecimalFormat dollar = new DecimalFormat("#,##0.00");
  
    str = "Description: " + description +
          "Item Price: " + price +
          "\nItem Number: " + unitsOnHand +
          "\nWhole Cost: $" + dollar.format(cost.wholeSale) +
          "\nRetail Price: $" + dollar.format(cost.Retail);
  
          return str;
  }
  
  public class CostData
  {
   public double wholeSale;
   public double Retail;
  
   public CostData(double whole,double re)
   {
    wholeSale = whole;
    Retail = re;
  
   }
  
   public void setRetail(double re)
   {
    Retail = re;
   }
  
  public void setWholeSale(double whole)
  {
    wholeSale = whole;
  }
  
  public double getRetail()
  {
    return Retail;
  }
  public double getWholeSale()
  {
    return wholeSale;
  }
  
  
  }    
  } 
  </code></pre>
  
  <p>Here is the Cash Register class:</p>
  
  <pre><code>public class CashRegister
  {
   private RetailItem retail;
   private int quantityItem;
   private final double SALES_TAX = 0.06;
   private int subTotal;
  
  
   public CashRegister()
  {
    quantityItem = 0;
    subTotal = 0;
  }
  
  
   public CashRegister(RetailItem retailObject,int quantity)
  {
    retail = new RetailItem(retailObject);
    quantityItem = quantity;
  }
  
  public RetailItem getRetailItem()
  {
    return new RetailItem(retail);
  }
  
  public double getSubTotal()
  {
   return quantityItem * retail.cost.getRetail();//Here is where the problem is 
  
  }
  
  public double getTax()
  {
    return SALES_TAX;
  }
  public double getTotal()
  {
    return subTotal + SALES_TAX;
  }
  
  }
  </code></pre>