Total beginner question. I am attempting to create a method for a class that calculates the total price for an object based on int Quantity and decimal price. Both of these are private and have Instance Variable Property Assignments. I cannot figure out how to access them and compute on them when I am using two separate parameters in the method. The method in question is the GetInvoiceAmount. Any suggestions would be greatly appreciated
//create invoice class
//intialize instance
public class Invoice
{
public decimal total; //instance variable to store invoice total
//public string InitialPartNumber;
//public string InitialDescription;
//public int InitialQuantity;
//public decimal InitialPrice;
//public decimal InvoiceAmount;
// auto-imlemented property for class Invoice
public string PartNumber { get; set; }
public string Description { get; set; }
private int quantity; // quantity of items purchased
private decimal price; // price per item
public decimal invoiceAmount;
public Invoice(string partNumber, string description, int quantity, decimal price)
{
PartNumber = partNumber;
Description = description;
Quantity = quantity;
Price = price;
}//end constructor
// begin GetInvoiceAmount Method
public void GetInvoiceAmount()
{
invoiceAmount = Price * Quantity;
}
//Begin Instance Variable Property Assignment
public int Quantity
{
get
{
return quantity;
} //end get
set
{
if (value >=0 )
quantity = value;
} //end set
}//end property Quantity
public decimal Price
{
get
{
return price;
} //end get
set
{
if ( value >=0 )
price = value;
} //end set
}//end property Price
}//end Invoice class