-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
82 lines (71 loc) · 2.5 KB
/
Program.cs
File metadata and controls
82 lines (71 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;
internal class Program
{
private static bool isFirstRun = true;
static void Main(string[] args)
{
if (isFirstRun)
{
DisplayWelcomeMessage();
isFirstRun = false;
}
var initialization = new Initialization();
var streetDistances = initialization.LoadStreetDistances("streetDistances.txt");
var cart = initialization.InitializeCart();
while (true)
{
Console.WriteLine("1. Add item to cart");
Console.WriteLine("2. Remove item from cart");
Console.WriteLine("3. View cart");
Console.WriteLine("4. Checkout");
Console.WriteLine("5. Exit");
string choice = Console.ReadLine();
switch (choice)
{
case "1":
cart.AddItemToCart();
break;
case "2":
cart.DisplayCart();
Console.WriteLine("Enter the number of the item to remove:");
if (int.TryParse(Console.ReadLine(), out int index))
{
cart.RemoveItem(index - 1);
}
else
{
Console.WriteLine("Invalid input.");
}
break;
case "3":
cart.DisplayCart();
break;
case "4":
Order.Checkout(cart, streetDistances);
break;
case "5":
return;
default:
Console.WriteLine("Invalid choice. Please try again.");
break;
}
}
}
static void DisplayWelcomeMessage()
{
Console.WriteLine("Hello! Welcome to BYU packing drone facility.");
Console.WriteLine("Please choose up to three items and/or 20 pounds so the drones can deliver your packages safely.");
Console.WriteLine("When you are finished, check out and put your street name.");
Console.WriteLine("We will calculate your estimated wait time based on the weight of your package. Enjoy!");
Console.WriteLine();
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
</Project>