Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Ass1
- {
- class Arrays
- {
- static void Main(string[] args)
- {
- const int MAX_PEOPLE = 50;
- string[] people;
- people = new string[MAX_PEOPLE];
- string[] full_name;
- full_name = new string[MAX_PEOPLE];
- string[] adress;
- adress = new string[MAX_PEOPLE];
- string[] street_number;
- street_number = new string[MAX_PEOPLE];
- string[] state;
- state = new string[MAX_PEOPLE];
- string[] phone_number;
- phone_number = new string[MAX_PEOPLE];
- string[] post_code;
- post_code = new string[MAX_PEOPLE];
- float[] hours_worked;
- hours_worked = new float[MAX_PEOPLE];
- int current_people = 0;
- int total_people = 0;
- string tval = "";
- int c = 0;
- char choise = ' ';
- string vtemp = "";
- bool parseAttempt = true;
- string response = "";
- //Menu displayed
- while (response != "x" && response != "X")
- {
- Console.WriteLine("---------------What do you want to do ?---------------");
- Console.WriteLine("");
- Console.WriteLine("Add a person (a).");
- Console.WriteLine("Find a person(s).");
- Console.WriteLine("Display current person (p).");
- Console.WriteLine("Delete current person (d)");
- Console.WriteLine("Calculate and display pay slip for current person (c)");
- Console.WriteLine("");
- Console.WriteLine("Press 'x' to Exit. ");
- response = Console.ReadLine();
- switch (response)
- {
- case "a":
- do
- {
- if (total_people < MAX_PEOPLE)
- {
- Console.Write("Enter person's full name >");
- tval = Console.ReadLine();
- full_name[current_people] = tval;
- Console.Write("Enter person's Street number >");
- tval = Console.ReadLine();
- street_number[current_people] = tval;
- Console.Write("Enter person's Street adress >");
- tval = Console.ReadLine();
- adress[current_people] = tval;
- Console.Write("Enter person's State >");
- tval = Console.ReadLine();
- state[current_people] = tval;
- Console.Write("Enter person's Post code >");
- tval = Console.ReadLine();
- post_code[current_people] = tval;
- Console.Write("Enter person's phone number >");
- tval = Console.ReadLine();
- phone_number[current_people] = tval;
- Console.Write("Enter person's worked hours >");
- tval = Console.ReadLine();
- hours_worked[current_people] = float.Parse(tval);
- }
- else
- Console.WriteLine("Person max {0} reached unable to store any more people", MAX_PEOPLE);
- //Ask user to continue
- Console.Write("Press 's'to continue or 'x' to exit ");
- choise = char.Parse(Console.ReadLine());
- } while (choise == 's');
- Console.Write("Enter the person to find >");
- tval = Console.ReadLine();
- for (c = 0; c < total_people; c++)
- {
- if (people[c] == tval)
- {
- current_people = c;
- break;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement