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 ConsoleApplication52
- {
- class Program
- {
- static List<string> Nice = new List<string>();
- static List<string> Naughty = new List<string>();
- static void Main(string[] args)
- {
- bool conti = true;
- while (conti)
- {
- Console.WriteLine("Welcome to the Christmas data base.");
- Console.WriteLine(" 1) Add New Child");
- Console.WriteLine(" 2) View Nice");
- Console.WriteLine(" 3) View Naughty");
- Console.WriteLine(" 4) Remove Child from List once present has been delivered");
- Console.WriteLine(" 5) Compare Lists to ensure child hasn't been added to both lists");
- int input = Convert.ToInt32(Console.ReadLine());
- if (input == 1)
- {
- Console.WriteLine("Please select which list you would like to add a child to");
- string option = Console.ReadLine();
- if (option == "nice")
- {
- Console.WriteLine("Please add the child to the NICE list");
- Nice.Add(Console.ReadLine());
- }
- else if (option == "naughty")
- {
- Console.WriteLine("Please add the child to the NAUGHTY list");
- Naughty.Add(Console.ReadLine());
- }
- }
- if (input == 2)
- {
- Console.Clear();
- Console.WriteLine("Viewing Nice List");
- foreach (string item in Nice)
- {
- Console.WriteLine(item);
- }
- Console.WriteLine("Total children on list = " + Nice.Count);
- }
- if (input == 3)
- {
- Console.Clear();
- Console.WriteLine("Viewing Naughty List");
- foreach (string item in Naughty)
- {
- Console.WriteLine(item);
- }
- Console.WriteLine("Total children on list = " + Naughty.Count);
- }
- if (input == 4)
- {
- Console.WriteLine("Which list does the child need removing from?");
- string remove = Console.ReadLine();
- if (remove == "nice")
- {
- foreach (string item in Nice)
- {
- Console.WriteLine(item);
- }
- Console.WriteLine("Which Child needs removing?");
- string childremove = Console.ReadLine();
- if (Nice.Contains(childremove))
- {
- Nice.Remove(childremove);
- Console.WriteLine("Removing child " + childremove);
- }
- }
- if (remove == "naughty")
- {
- foreach (string item in Naughty)
- {
- Console.WriteLine(item);
- }
- Console.WriteLine("Which Child needs removing?");
- string childremove = Console.ReadLine();
- if (Nice.Contains(childremove))
- {
- Naughty.Remove(childremove);
- Console.WriteLine("Removing child " + childremove);
- }
- }
- }
- if (input == 5)
- {
- bool isFound = false;
- foreach (string x in Naughty)
- {
- if (Nice .Contains(x))
- {
- isFound = true;
- Console.WriteLine("This child is one both lists! They need removing from one of the lists!");
- }
- }
- }
- Console.WriteLine("Return to menu?");
- string decision = Console.ReadLine();
- if (decision == "yes")
- {
- conti = true;
- Console.Clear();
- }
- else if (decision == "no")
- {
- conti = false;
- }
- }
- }
- }
- }
- /// {
- /// Nice.Sort();
- /// Console.WriteLine(Nice);
- /// foreach (string item in Nice)
- /// {
- /// Console.WriteLine(item);
- /// }
- /// }
Add Comment
Please, Sign In to add comment