callumbinner22

Christmas Banter

Dec 15th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication52
  8. {
  9.     class Program
  10.     {
  11.         static List<string> Nice = new List<string>();
  12.         static List<string> Naughty = new List<string>();
  13.         static void Main(string[] args)
  14.         {
  15.  
  16.             bool conti = true;
  17.  
  18.             while (conti)
  19.             {
  20.  
  21.  
  22.  
  23.                 Console.WriteLine("Welcome to the Christmas data base.");
  24.                 Console.WriteLine(" 1) Add New Child");
  25.                 Console.WriteLine(" 2) View Nice");
  26.                 Console.WriteLine(" 3) View Naughty");
  27.                 Console.WriteLine(" 4) Remove Child from List once present has been delivered");
  28.                 Console.WriteLine(" 5) Compare Lists to ensure child hasn't been added to both lists");
  29.                 int input = Convert.ToInt32(Console.ReadLine());
  30.  
  31.  
  32.  
  33.                 if (input == 1)
  34.                 {
  35.                     Console.WriteLine("Please select which list you would like to add a child to");
  36.                     string option = Console.ReadLine();
  37.                     if (option == "nice")
  38.                     {
  39.                         Console.WriteLine("Please add the child to the NICE list");
  40.                         Nice.Add(Console.ReadLine());
  41.                     }
  42.                     else if (option == "naughty")
  43.                     {
  44.                         Console.WriteLine("Please add the child to the NAUGHTY list");
  45.                         Naughty.Add(Console.ReadLine());
  46.                     }
  47.                 }
  48.  
  49.                 if (input == 2)
  50.                 {
  51.                     Console.Clear();
  52.                     Console.WriteLine("Viewing Nice List");
  53.                     foreach (string item in Nice)
  54.                     {
  55.                         Console.WriteLine(item);
  56.                     }
  57.                     Console.WriteLine("Total children on list = " + Nice.Count);
  58.                 }
  59.  
  60.                 if (input == 3)
  61.                 {
  62.                     Console.Clear();
  63.                     Console.WriteLine("Viewing Naughty List");
  64.                     foreach (string item in Naughty)
  65.                     {
  66.                         Console.WriteLine(item);
  67.                     }
  68.                     Console.WriteLine("Total children on list = " + Naughty.Count);
  69.                 }
  70.  
  71.                 if (input == 4)
  72.                 {
  73.  
  74.                     Console.WriteLine("Which list does the child need removing from?");
  75.                     string remove = Console.ReadLine();
  76.                     if (remove == "nice")
  77.                     {
  78.                         foreach (string item in Nice)
  79.                         {
  80.                             Console.WriteLine(item);
  81.                         }
  82.                         Console.WriteLine("Which Child needs removing?");
  83.                         string childremove = Console.ReadLine();
  84.                         if (Nice.Contains(childremove))
  85.                         {
  86.                             Nice.Remove(childremove);
  87.                             Console.WriteLine("Removing child " + childremove);
  88.                         }
  89.  
  90.                     }
  91.                     if (remove == "naughty")
  92.                     {
  93.                         foreach (string item in Naughty)
  94.                         {
  95.                             Console.WriteLine(item);
  96.                         }
  97.                         Console.WriteLine("Which Child needs removing?");
  98.                         string childremove = Console.ReadLine();
  99.                         if (Nice.Contains(childremove))
  100.                         {
  101.                             Naughty.Remove(childremove);
  102.                             Console.WriteLine("Removing child " + childremove);
  103.                         }
  104.                     }
  105.                 }
  106.  
  107.                 if (input == 5)
  108.                 {
  109.                    
  110.                     bool isFound = false;
  111.                     foreach (string x in Naughty)
  112.                     {
  113.                      if (Nice .Contains(x))
  114.                     {
  115.                       isFound = true;
  116.                       Console.WriteLine("This child is one both lists! They need removing from one of the lists!");
  117.                     }
  118.                    }
  119.                 }
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.                     Console.WriteLine("Return to menu?");
  133.                     string decision = Console.ReadLine();
  134.                     if (decision == "yes")
  135.                     {
  136.                         conti = true;
  137.                         Console.Clear();
  138.                     }
  139.                     else if (decision == "no")
  140.                     {
  141.                         conti = false;
  142.                     }
  143.                 }
  144.  
  145.             }
  146.         }
  147.     }
  148.  
  149.      ///   {
  150.     ///                Nice.Sort();
  151.     ///                Console.WriteLine(Nice);
  152.     ///                foreach (string item in Nice)
  153.      ///               {
  154.      ///                   Console.WriteLine(item);
  155.      ///               }
  156.  
  157.      ///           }
Add Comment
Please, Sign In to add comment