Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace P04VendingMachine
  8. {
  9. class Program
  10. {
  11. static List<VendingItemClass> items = new List<VendingItemClass>();
  12. static void Main(string[] args)
  13. {
  14. FillMachine();
  15. }
  16.  
  17. static void FillMachine() //will instantiate objects of type VendingItemClass for each item.
  18. //store in a List of VendingItemClass called items.
  19. {
  20.  
  21. }
  22.  
  23. static void DisplayMachine()
  24. {
  25. int moneyInserted;
  26. //sean code until Bills inserted () part
  27. int i = 0;
  28. while (i < items.Count)
  29. {
  30. Console.Write("~".PadRight(3));
  31. Console.Write(items[i].location + ": " + items[i].item + " ".PadRight(20));
  32. Console.Write(items[i + 1].location + ": " + items[i + 1].item + " ".PadRight(20));
  33. Console.WriteLine("~");
  34. Console.Write("Price $" + items[i]price.PadLeft(20);
  35.  
  36. Console.WriteLine("Bills Inserted ($1, $2, $5, or 0 to end): "); //Machine will only take paper money in 1/2/5. only 1 bill per transaction
  37. moneyInserted = Console.Read();
  38. //if (moneyInserted != 1 || moneyInserted != 2 || moneyInserted != 5) find out if error checking.
  39. // Console.WriteLine("")
  40. Console.WriteLine("You Have inserted {0}. Please make your selection:", moneyInserted);
  41. }
  42. }
  43.  
  44. static void MakeChange() //pass the object and money into here and return a strnig to display their change.
  45. {
  46.  
  47. Console.WriteLine("Your change is {0}");
  48. VendingItemClass.ReduceInventory();
  49. DisplayMachine();
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement