Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class Program
- {
- public static void Main()
- {
- int wines = 300;
- int winesD = 0;
- int winesO = 0;
- int beers = 200;
- int beersD = 0;
- int beersO = 0;
- while (true)
- {
- String input = Console.ReadLine();
- if (input == "END"){
- break;
- }
- String[] str = input.Split(':');
- String drink = str[0];
- int quantity = int.Parse(str[1]);
- if (drink == "Beers")
- {
- beers += quantity;
- if (quantity > 0)
- {
- beersD++;
- }
- else if (quantity > 0)
- {
- beersO++;
- }
- }
- else if (drink == "Wines")
- {
- wines += quantity;
- if (quantity > 0)
- {
- winesD++;
- }
- else
- {
- winesO++;
- }
- }
- }
- Console.WriteLine("Wines: " + wines);
- Console.WriteLine("Deliveries: " + winesD);
- Console.WriteLine("Orders: " + winesO);
- Console.WriteLine("Beers: " + beers);
- Console.WriteLine("Deliveries: " + beersD);
- Console.WriteLine("Orders: " + beersO);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement