Guest User

Untitled

a guest
Feb 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace _64ET5913Basics2
  7. {
  8.     class BasicsLab2
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.ForegroundColor = ConsoleColor.Green;
  13.             Console.BackgroundColor = ConsoleColor.Blue;
  14.             Console.WriteLine("Welcome to David's Console for 64ET5913. - Lab 2");
  15.             Console.ResetColor();
  16.  
  17.             Console.Write("\nPlease enter your name: ");
  18.             Console.BackgroundColor = ConsoleColor.Red;
  19.             Console.ForegroundColor = ConsoleColor.Yellow;
  20.             string name;
  21.             name = Console.ReadLine();
  22.             Console.ResetColor();
  23.             Console.BackgroundColor = ConsoleColor.Blue;
  24.             Console.ForegroundColor = ConsoleColor.Green;
  25.             Console.WriteLine("\nHello, " + name + "!");
  26.             Console.ResetColor();
  27.  
  28.             lastyear:
  29.             Console.Write("\nPlease enter your last year progamming mark: ");
  30.             Console.BackgroundColor = ConsoleColor.Red;
  31.             Console.ForegroundColor = ConsoleColor.Yellow;
  32.             string lastyear = Console.ReadLine();
  33.             Console.ResetColor();
  34.             int lastyearint;
  35.             if (int.TryParse(lastyear, out lastyearint) == false || lastyearint < 35 || lastyearint > 100)
  36.             {
  37.                 Console.WriteLine("\nPlease enter a number in the range of 35-100 only!");
  38.                 goto lastyear;
  39.             }
  40.             Console.BackgroundColor = ConsoleColor.Blue;
  41.             Console.ForegroundColor = ConsoleColor.Green;
  42.             Console.WriteLine("\nSo " + name + ", you got " + lastyearint.ToString() + "% last year. Go you!");
  43.             Console.ResetColor();
  44.  
  45.             thisYear:
  46.             Console.Write("\nSo what are you expected to get this year: ");
  47.             Console.BackgroundColor = ConsoleColor.Red;
  48.             Console.ForegroundColor = ConsoleColor.Yellow;
  49.             string thisYear = Console.ReadLine();
  50.             Console.ResetColor();
  51.             int thisYearint;
  52.             if (int.TryParse(thisYear, out thisYearint) == false || thisYearint < 0 || thisYearint > 100)
  53.             {
  54.                 Console.WriteLine("\nPlease enter a number in the range of 0-100 only!");
  55.                 goto thisYear;
  56.             }
  57.  
  58.             Console.BackgroundColor = ConsoleColor.Blue;
  59.             Console.ForegroundColor = ConsoleColor.Yellow;
  60.             if (thisYearint < 40)
  61.             {
  62.                 Console.WriteLine("\nFailure.");
  63.             }
  64.             else if (thisYearint >= 40 && thisYearint < 50)
  65.             {
  66.                 Console.WriteLine("\nThird Class.");
  67.             }
  68.             else if (thisYearint >= 50 && thisYearint < 60)
  69.             {
  70.                 Console.WriteLine("\nLower Second Class");
  71.             }
  72.             else if (thisYearint >= 60 && thisYearint < 70)
  73.             {
  74.                 Console.WriteLine("\nUpper Second Class");
  75.             }
  76.             else if (thisYearint >= 70)
  77.             {
  78.                 Console.WriteLine("\nFirst Class");
  79.             }
  80.        
  81.             int markDifference = thisYearint - lastyearint;
  82.            
  83.             Console.BackgroundColor = ConsoleColor.Blue;
  84.             Console.ForegroundColor = ConsoleColor.Green;
  85.             Console.WriteLine("\nSo a difference of " + markDifference.ToString() + "%, Good Luck!");
  86.             Console.ResetColor();
  87.  
  88.             Console.WriteLine("\nPress any key to exit...");
  89.             Console.ReadKey();
  90.         }
  91.     }
  92. }
Add Comment
Please, Sign In to add comment