Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class item
- {
- private decimal unitPrice;
- private int quantity;
- public int Quantity
- {
- get{return quantity;}
- set{quantity= value;}
- }
- public decimal CalculateCost()
- {
- return unitPrice*quantity
- }
- }
- class test{
- //mainmethod
- Item item = new item();
- item.Quantity = 5;
- item.UnitPrice = 12.50;
- item.CalculateCost(); //display the cost
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement