Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication50
- {
- class Program
- {
- static void Main(string[] args)
- {
- int x = 0;
- Stack employee = new Stack();
- employee.Push("Callum");
- employee.Push("Matt");
- employee.Push("Harry");
- employee.Push("Jacob");
- while (x < 1)
- {
- int input;
- Console.WriteLine(" 1) Enter new employee name");
- Console.WriteLine(" 2) Check who is at top of redundancy list. ");
- Console.WriteLine(" 3) Remove employee who has been made redundant. ");
- input = Convert.ToInt32(Console.ReadLine());
- if (input == 1)
- {
- Console.WriteLine("Enter New Employee's name ");
- string newemployee = Console.ReadLine();
- employee.Push(newemployee);
- }
- if (input == 2)
- {
- Console.WriteLine(employee.Peek());
- }
- else if (input ==3)
- {
- Console.WriteLine("Erasing " + employee.Peek());
- employee.Pop();
- Console.WriteLine("It is done!");
- }
- Console.WriteLine("Would you like to continue?");
- string decision = Console.ReadLine();
- if ( decision == "yes")
- {
- x = 0;
- }
- else if (decision == "no")
- {
- x=1;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement