Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CIT143Project4
- {
- class Program
- {
- 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();
- }
- }
- private static void inputHouseholdInfo()
- {
- Console.WriteLine("Would you like to enter household information? ");
- string moreInfo = Console.ReadLine();
- string moreInfoString = moreInfo.ToLower();
- while (moreInfoString != "no" || moreInfoString != "n")
- {
- Console.WriteLine("What is the name of the family? ");
- string[] householdName = new string[10];
- for (int i = 0; i < 10; i++)
- {
- householdName[i] = Console.ReadLine();
- }
- Console.WriteLine("What is the income of this family?");
- Double[] householdIncome = new Double[10];
- for (int count = 0; count < 10; count++)
- {
- householdIncome[count] = Double.Parse(Console.ReadLine());
- }
- Console.WriteLine("How many members are in this household?");
- Double[] householdMembers = new Double[10];
- for (int counter = 0; counter < 10; counter++)
- {
- householdMembers[counter] = Double.Parse(Console.ReadLine());
- }
- }
- }
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement