Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace _64ET5913Basics2
- {
- class BasicsLab2
- {
- static void Main(string[] args)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.WriteLine("Welcome to David's Console for 64ET5913. - Lab 2");
- Console.ResetColor();
- Console.Write("\nPlease enter your name: ");
- Console.BackgroundColor = ConsoleColor.Red;
- Console.ForegroundColor = ConsoleColor.Yellow;
- string name;
- name = Console.ReadLine();
- Console.ResetColor();
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("\nHello, " + name + "!");
- Console.ResetColor();
- lastyear:
- Console.Write("\nPlease enter your last year progamming mark: ");
- Console.BackgroundColor = ConsoleColor.Red;
- Console.ForegroundColor = ConsoleColor.Yellow;
- string lastyear = Console.ReadLine();
- Console.ResetColor();
- int lastyearint;
- if (int.TryParse(lastyear, out lastyearint) == false || lastyearint < 35 || lastyearint > 100)
- {
- Console.WriteLine("\nPlease enter a number in the range of 35-100 only!");
- goto lastyear;
- }
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("\nSo " + name + ", you got " + lastyearint.ToString() + "% last year. Go you!");
- Console.ResetColor();
- thisYear:
- Console.Write("\nSo what are you expected to get this year: ");
- Console.BackgroundColor = ConsoleColor.Red;
- Console.ForegroundColor = ConsoleColor.Yellow;
- string thisYear = Console.ReadLine();
- Console.ResetColor();
- int thisYearint;
- if (int.TryParse(thisYear, out thisYearint) == false || thisYearint < 0 || thisYearint > 100)
- {
- Console.WriteLine("\nPlease enter a number in the range of 0-100 only!");
- goto thisYear;
- }
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.ForegroundColor = ConsoleColor.Yellow;
- if (thisYearint < 40)
- {
- Console.WriteLine("\nFailure.");
- }
- else if (thisYearint >= 40 && thisYearint < 50)
- {
- Console.WriteLine("\nThird Class.");
- }
- else if (thisYearint >= 50 && thisYearint < 60)
- {
- Console.WriteLine("\nLower Second Class");
- }
- else if (thisYearint >= 60 && thisYearint < 70)
- {
- Console.WriteLine("\nUpper Second Class");
- }
- else if (thisYearint >= 70)
- {
- Console.WriteLine("\nFirst Class");
- }
- int markDifference = thisYearint - lastyearint;
- Console.BackgroundColor = ConsoleColor.Blue;
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("\nSo a difference of " + markDifference.ToString() + "%, Good Luck!");
- Console.ResetColor();
- Console.WriteLine("\nPress any key to exit...");
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment