Advertisement
emsiardy

TheApp1

Mar 28th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.56 KB | None | 0 0
  1. /*
  2.  * Developer: Drennen Dooms
  3.  * Date: 3/28/2015
  4.  * Purpose: To retreive the info and display it
  5.  */
  6. using System;
  7. using System.Windows.Forms;
  8.  
  9. namespace MonthApp
  10. {
  11.     class MonthApp
  12.     {
  13.  
  14.         static void Main()
  15.         {
  16.             int monthNum;
  17.            
  18.            
  19.             monthNum = InputMonth();
  20.  
  21.            
  22.             MonthClass newMonth = new MonthClass(monthNum);
  23.            
  24.             Console.Clear();
  25.             Console.WriteLine(newMonth);
  26.             Console.ReadKey();
  27.  
  28.  
  29.         }
  30.  
  31.         private static void AskForReturn(out bool yes)
  32.         {
  33.             throw new NotImplementedException();
  34.         }
  35.  
  36.         public static int InputMonth()
  37.         {
  38.            
  39.             string inputValue;
  40.             int monthNumber;
  41.  
  42.             Console.WriteLine("Please enter the month number");
  43.             inputValue = Console.ReadLine();
  44.             if (int.TryParse(inputValue, out monthNumber) == false)
  45.                 Console.WriteLine("Invalid entry. 0 will be recorded.");
  46.  
  47.  
  48.             AskForReturn();
  49.             return monthNumber;
  50.         }
  51.         public static void AskForReturn(){
  52.  
  53.             string s = Console.ReadLine();
  54.  
  55.             Console.WriteLine("Would you like to run the application again?" +
  56.                                 "\nIf yes, type Y. If no, enter anything else.");
  57.             Console.Read();
  58.  
  59.             if (s != "y" || s != "Y")
  60.             {
  61.                 return;
  62.             }
  63.             else { Main(); }
  64.            
  65.  
  66.         }
  67.  
  68.  
  69.  
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement