Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace sodacrate.cs
- {
- class laskback
- {
- private string[] sodacrate = new string[24];
- private int antal_flaskor = 0;
- public void Run()
- {
- int lask = 1;
- do
- {
- Console.WriteLine("Välkommen till läskbacken");
- Console.WriteLine(" 1. Lägg till dryck.");
- Console.WriteLine(" 2. Visa innehåll i backen.");
- Console.WriteLine(" 3. Beräkna värde för innehållet.");
- Console.WriteLine(" 4. Avsluta programmet");
- switch (Console.ReadLine())
- {
- case "1":
- LaggTillDryck(antal_flaskor);
- antal_flaskor = antal_flaskor + 1;
- break;
- case "2":
- VisaInnehall();
- break;
- case "3":
- BeraknaVarde();
- break;
- case "4":
- lask = 0;
- break;
- }
- } while (lask != 0);
- }
- public void LaggTillDryck(int pos)
- {
- Console.WriteLine("Dryck");
- Console.WriteLine("* 1 coca ");
- Console.WriteLine("* 2 Fanta ");
- Console.WriteLine("* 3 julmust ");
- Console.WriteLine("* 4 Sprite ");
- Console.WriteLine("* 5 Loka ");
- sodacrate[pos] = Console.ReadLine();
- }
- public void VisaInnehall()
- {
- for (int i = 0; i < 24; i++)
- {
- Console.WriteLine(sodacrate[i]);
- }
- }
- public void BeraknaVarde()
- {
- Console.WriteLine(antal_flaskor);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement