Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- /// <summary>
- /// Summary description for Cart
- /// </summary>
- public class Cart
- {
- private double totalPrice = 0;
- private List<String> titles = new List<String>();
- private List<double> prices = new List<double>();
- public Cart()
- {
- }
- public double getPrice()
- {
- return totalPrice;
- }
- public void updatePrice(double price)
- {
- totalPrice += price;
- }
- public void subPrice(double price)
- {
- totalPrice -= price;
- }
- public List<String> getTitles()
- {
- return titles;
- }
- public String getTitle(int index)
- {
- return titles[index];
- }
- public int getSize()
- {
- return titles.Count;
- }
- public void addTitle(String title)
- {
- this.titles.Add(title);
- }
- public void addPrice(Double price)
- {
- this.prices.Add(price);
- }
- public double getPrices(int index)
- {
- return prices[index];
- }
- public void removeTitle(int index)
- {
- titles.RemoveAt(index);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement