Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Test
- {
- class Program
- {
- private static string[] householdName = new string[100];
- private static double[] householdIncome = new double[100];
- private static double[] householdMembers = new double[100];
- static void Main(string[] args)
- {
- Console.WriteLine("List of menu choices: ");
- Console.WriteLine("");
- Console.WriteLine("\t 1: Enter household information. ");
- Console.WriteLine("\t 2: Determine the assistance qualification. ");
- Console.WriteLine("\t 3: Display the household report. ");
- Console.WriteLine("\t 4: Exit the program. ");
- Console.WriteLine("");
- Console.WriteLine("Which menu choice would you like to access? ");
- Double menuChoice = Double.Parse(Console.ReadLine());
- while (menuChoice == 1)
- {
- inputHouseholdInfo();
- }
- while (menuChoice == 2)
- {
- determineAssistance(householdIncome, householdMembers);
- }
- while (menuChoice == 3)
- {
- displayHouseholdInfo(householdIncome, householdMembers, householdName);
- }
- while (menuChoice == 4)
- {
- Console.WriteLine("Thank you for using the assitance calculator. Have a great day! ");
- break;
- }
- }
- private static void inputHouseholdInfo()
- {
- Console.WriteLine("Do you have more households to enter? (yes/no) ");
- string moreInfo = Console.ReadLine();
- string moreInfoString = moreInfo.ToLower();
- while (moreInfoString != "n" && moreInfoString != "no") {
- for (int counter = 0; counter < householdName.Length; counter++)
- {
- Console.WriteLine("What is the name of the family? ");
- householdName[counter] = Console.ReadLine();
- Console.WriteLine("What is the income of this family?");
- householdIncome[counter] = Double.Parse(Console.ReadLine());
- Console.WriteLine("How many members are in this household?");
- householdMembers[counter] = Double.Parse(Console.ReadLine());
- return;
- }
- break;
- }
- }
- private static string determineAssistance(Double[] householdIncome, Double[] householdMembers)
- {
- string assistanceNeeded = "";
- for (int k = 0; k < householdIncome.Length; k++)
- {
- if (householdMembers[k] == 1 && householdIncome[k] > 15782)
- {
- assistanceNeeded = "N";
- }
- else
- {
- assistanceNeeded = "Y";
- return String.Concat(assistanceNeeded);
- }
- if ((householdIncome[k] / householdMembers[k]) >= 5618)
- {
- assistanceNeeded = "N";
- }
- else
- {
- assistanceNeeded = "Y";
- return String.Concat(assistanceNeeded);
- }
- }
- return String.Concat(assistanceNeeded);
- }
- private static void displayHouseholdInfo(double[] householdIncome, double[] householdMembers, string[] householdName)
- {
- Console.WriteLine("Results: ");
- Console.WriteLine(String.Format("{0} {1} {2}", householdIncome, householdMembers, householdName));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement