-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWhatsTheCost.cs
33 lines (28 loc) · 1.12 KB
/
WhatsTheCost.cs
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
class Program
{
public static void Main(string[] args)
{
string purchase, ePurchase; ;
int many, eMany;
double cost, eCost;
Console.Write("What're you buying? ");
purchase = Console.ReadLine();
Console.Write("How many? ");
many = Convert.ToInt32(Console.ReadLine());
Console.Write("What do they cost? ");
cost = Convert.ToDouble(Console.ReadLine());
Console.Write("\nWhat else're you buying? ");
ePurchase = Console.ReadLine();
Console.Write("How many? ");
eMany = Convert.ToInt32(Console.ReadLine());
Console.Write("What do they cost? ");
eCost = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("\nYour list:\n----");
Console.WriteLine(purchase +" (" + many + ")");
Console.WriteLine("$"+cost + " ($" + cost * many + " total)");
Console.WriteLine("\n"+ ePurchase +" (" + eMany + ")");
Console.WriteLine("$"+eCost + " ($" + eCost * eMany + " total)");
Console.WriteLine("\nTotal Cost: $" + (eCost * eMany + cost * many));
Console.WriteLine("----");
}
}