Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Order
- {
- private double _price;
- private double _quantity;
- public double TotalCash
- {
- get
- {
- return _price * _quantity;
- }
- }
- public class Order
- {
- private double _totalCash;
- private double _price;
- private double _quantity;
- private void CalcCashTotal()
- {
- _totalCash = _price * _quantity
- }
- public double Price
- {
- set
- {
- _price = value;
- CalcCashTotal();
- }
- }
- public double Quantity
- {
- set
- {
- _price = value;
- CalcCashTotal();
- }
- }
- public double TotalCash
- {
- get
- {
- return _totalCash;
- }
- }
- public class Order
- {
- private double _totalCash;
- private double _price;
- private double _quantity;
- private _IsDirtyTotalCash = true;
- private void CalcCashTotal()
- {
- _totalCash = _price * _quantity
- }
- public double Price
- {
- set
- {
- _price = value;
- _IsDirtyTotalCash = true;
- }
- }
- public double Quantity
- {
- set
- {
- _price = value;
- _IsDirtyTotalCash = true;
- }
- }
- public double TotalCash
- {
- get
- {
- if(_IsDirtyTotalCash)
- {
- _totalCash = CalcTotalCost();
- _isDirtyTotalCash = false;
- }
- return _totalCash;
- }
- }
- }
- double subTotal = myOrder.TotalCash;
- double tax = subTotal * 0.05;
- double shipping = subTotal > 100 ? 0 : 5.95;
- double grandTotal = subTotal + tax + shipping;
- OutputToUser(subTotal, tax, shipping, grandTotal);
- double tax = myOrder.TotalCash * 0.05;
- double shipping = myOrder.TotalCash > 100 ? 0 : 5.95;
- double grandTotal = myOrder.TotalCash + tax + shipping;
- OutputToUser(myOrder.TotalCash, tax, shipping, grandTotal);
- class Wall {
- public decimal Width {
- get {
- ...
- }
- set {
- ValidateChanges();
- width = value;
- CreateBays();
- }
- }
- public Bays[] Bays {
- get {
- ...
- }
- set {
- ValidateChanges();
- ...
- }
- }
- private void CreateBays() {
- // Delete all the old bays.
- ...
- // Create a new bay per spacing interval given the wall width.
- ...
- }
- }
Add Comment
Please, Sign In to add comment