Advertisement
ivanov_ivan

PerfectGirlfriend

Nov 15th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PerfectGirlfriend
  8.     {
  9.     class PerfectGirlfriend
  10.         {
  11.         static void Main()
  12.             {
  13.             string[] input = Console.ReadLine().Split('\\');
  14.             int perfectGirls = 0;
  15.             while (input[0] != "Enough dates!")
  16.                 {
  17.                 int telephoneSum = 0;
  18.                 foreach (var item in input[1])
  19.                     {
  20.                     telephoneSum += (int)char.GetNumericValue(item);
  21.                     }
  22.                 switch (input[0])
  23.                     {
  24.                     case "Monday": telephoneSum += 1; break;
  25.                     case "Tuesday": telephoneSum += 2; break;
  26.                     case "Wednesday": telephoneSum += 3; break;
  27.                     case "Thursday": telephoneSum += 4; break;
  28.                     case "Friday": telephoneSum += 5; break;
  29.                     case "Saturday": telephoneSum += 6; break;
  30.                     case "Sunday": telephoneSum += 7; break;
  31.                     default: break;
  32.                     }
  33.                 int braSize = 0;
  34.                 string bra = "";
  35.                 char[] braSizeInput = input[2].Reverse().ToArray();
  36.                 for (int i  = braSizeInput.Length - 1; i  >= 1; i --)
  37.                     {
  38.                     bra += braSizeInput[i];
  39.                     }
  40.                 braSize = int.Parse(bra) * (int)braSizeInput[0];
  41.  
  42.                 char[] name = input[3].ToArray();
  43.                 int namecount = (int)name[0] * name.Length;
  44.  
  45.                 int result = (telephoneSum + braSize) - namecount;
  46.                 if (result > 6000)
  47.                     {
  48.                     Console.WriteLine("{0} is perfect for you.", input[3]);
  49.                     perfectGirls++;
  50.                     }
  51.                 else
  52.                     {
  53.                     Console.WriteLine("Keep searching, {0} is not for you.", input[3]);
  54.                     }
  55.                 input = Console.ReadLine().Split('\\');
  56.                 }
  57.             Console.WriteLine(perfectGirls);
  58.             }
  59.         }
  60.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement