-
Notifications
You must be signed in to change notification settings - Fork 5
/
P07_InventoryMatcher.cs
32 lines (31 loc) · 960 Bytes
/
P07_InventoryMatcher.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
using System;
using System.Linq;
namespace P07_InventoryMatcher
{
class P07_InventoryMatcher
{
static void Main(string[] args)
{
var goodsList = Console.ReadLine()
.Split(' ')
.ToList();
var quantities = Console.ReadLine()
.Split(' ')
.Select(long.Parse)
.ToList();
var prices = Console.ReadLine()
.Split(' ')
.Select(decimal.Parse)
.ToList();
var command = Console.ReadLine();
while (command != "done")
{
int indexOfGoods = goodsList.IndexOf(command);
Console.WriteLine(
$"{goodsList[indexOfGoods]} costs: {prices[indexOfGoods]}; Available quantity: {quantities[indexOfGoods]}"
);
command = Console.ReadLine();
}
}
}
}