Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Computer(string name, List<Component> components)
- {
- this.Name = name;
- this.Components = components;
- this.Price = CalcPrice(components);
- }
- private float CalcPrice(List<Component> components)
- {
- float totalPrice = 0;
- foreach (Component component in components)
- {
- totalPrice += component.Price;
- }
- return totalPrice;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement