Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5.  
  6. /// <summary>
  7. /// Summary description for Cart
  8. /// </summary>
  9. public class Cart
  10. {
  11. private double totalPrice = 0;
  12. private List<String> titles = new List<String>();
  13. private List<double> prices = new List<double>();
  14.  
  15. public Cart()
  16. {
  17.  
  18. }
  19.  
  20. public double getPrice()
  21. {
  22. return totalPrice;
  23. }
  24.  
  25. public void updatePrice(double price)
  26. {
  27. totalPrice += price;
  28. }
  29.  
  30. public void subPrice(double price)
  31. {
  32. totalPrice -= price;
  33. }
  34.  
  35. public List<String> getTitles()
  36. {
  37. return titles;
  38. }
  39.  
  40. public String getTitle(int index)
  41. {
  42. return titles[index];
  43. }
  44.  
  45. public int getSize()
  46. {
  47. return titles.Count;
  48. }
  49.  
  50. public void addTitle(String title)
  51. {
  52. this.titles.Add(title);
  53. }
  54.  
  55. public void addPrice(Double price)
  56. {
  57. this.prices.Add(price);
  58. }
  59.  
  60. public double getPrices(int index)
  61. {
  62. return prices[index];
  63. }
  64.  
  65. public void removeTitle(int index)
  66. {
  67. titles.RemoveAt(index);
  68.  
  69. }
  70.  
  71.  
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement