Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.20 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CIT143Project4
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("List of menu choices: ");
  10.             Console.WriteLine("");
  11.             Console.WriteLine("\t 1: Enter household information. ");
  12.             Console.WriteLine("\t 2: Determine the assistance qualification. ");
  13.             Console.WriteLine("\t 3: Display the household report. ");
  14.             Console.WriteLine("\t 4: Exit the program. ");
  15.             Console.WriteLine("");
  16.             Console.WriteLine("Which menu choice would you like to access? ");
  17.             Double menuChoice = Double.Parse(Console.ReadLine());
  18.  
  19.             while (menuChoice == 1)
  20.             {
  21.                 inputHouseholdInfo();
  22.             }
  23.  
  24.             while (menuChoice == 2)
  25.             {
  26.                 determineAssistance();
  27.             }
  28.  
  29.         }
  30.  
  31.         private static void inputHouseholdInfo()
  32.         {
  33.             Console.WriteLine("Would you like to enter household information? ");
  34.             string moreInfo = Console.ReadLine();
  35.             string moreInfoString = moreInfo.ToLower();
  36.  
  37.             while (moreInfoString != "no" || moreInfoString != "n")
  38.             {
  39.  
  40.                 Console.WriteLine("What is the name of the family? ");
  41.                 string[] householdName = new string[10];
  42.  
  43.                 for (int i = 0; i < 10; i++)
  44.                 {
  45.                     householdName[i] = Console.ReadLine();
  46.  
  47.                 }
  48.  
  49.                 Console.WriteLine("What is the income of this family?");
  50.                 Double[] householdIncome = new Double[10];
  51.                 for (int count = 0; count < 10; count++)
  52.                 {
  53.                     householdIncome[count] = Double.Parse(Console.ReadLine());
  54.  
  55.                 }
  56.  
  57.                 Console.WriteLine("How many members are in this household?");
  58.                 Double[] householdMembers = new Double[10];
  59.                 for (int counter = 0; counter < 10; counter++)
  60.                 {
  61.                     householdMembers[counter] = Double.Parse(Console.ReadLine());
  62.  
  63.                 }
  64.  
  65.             }
  66.  
  67.         }
  68.        
  69.         private static string determineAssistance(Double[] householdIncome, Double[] householdMembers)
  70.         {
  71.             string assistanceNeeded;
  72.  
  73.             for(int k = 0; k < householdIncome.Length; k++)
  74.             {
  75.                 if (householdMembers[k] == 1 && householdIncome[k] > 15782)
  76.                 {
  77.                     assistanceNeeded = "N";
  78.                    
  79.                 }
  80.                 else
  81.                 {
  82.                     assistanceNeeded = "Y";
  83.                     return String.Concat(assistanceNeeded);
  84.  
  85.                 }
  86.  
  87.                 if ((householdIncome[k] / householdMembers[k]) >= 5618)
  88.                 {
  89.                     assistanceNeeded = "N";
  90.                    
  91.                 }
  92.                 else
  93.                 {
  94.                     assistanceNeeded = "Y";
  95.                     return String.Concat(assistanceNeeded);
  96.  
  97.                 }
  98.  
  99.             }
  100.  
  101.             return String.Concat(assistanceNeeded);
  102.  
  103.         }
  104.        
  105.     }
  106.  
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement