stefan1919

C#MicrosoftMethodsAssignment

Oct 30th, 2015
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.26 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 AssignmentMethods
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.Write("Get information about: ");
  14.             string typeOfInformation = Console.ReadLine();
  15.             if (typeOfInformation == "student")
  16.             {
  17.                 GetStudentInformation();
  18.             }
  19.             else if (typeOfInformation == "course")
  20.             {
  21.                 GetCourseInformation();
  22.             }
  23.             else if (typeOfInformation == "degree")
  24.             {
  25.                 GetInformationDegree();
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine("Incorrect input!");
  30.             }
  31.  
  32.         }
  33.         static void GetStudentInformation()
  34.         {
  35.             string first = Console.ReadLine();
  36.             string second = Console.ReadLine();
  37.             string birthday = Console.ReadLine();
  38.             PrintStudentDetails(first, second, birthday);
  39.         }
  40.         static void PrintStudentDetails(string first, string second, string birthday)
  41.         {
  42.             Console.WriteLine("{0} {1} was born on: {2}", first, second, birthday);
  43.         }
  44.         static void GetCourseInformation()
  45.         {
  46.             string name = Console.ReadLine();
  47.             string professor = Console.ReadLine();
  48.             string credits = Console.ReadLine();
  49.             PrintCourseDetails(name, professor, credits);
  50.         }
  51.         static void PrintCourseDetails(string name, string teacher, string credits)
  52.         {
  53.             Console.WriteLine("The course name is: {0}, it is tought by {1}, and it is evaluated with {2} credits", name, teacher, credits);
  54.         }
  55.         static void GetInformationDegree()
  56.         {
  57.             string name = Console.ReadLine();
  58.             string department = Console.ReadLine();
  59.             string university = Console.ReadLine();
  60.             PrintDegree(name, department, university);
  61.         }
  62.         static void PrintDegree(string name, string faculty, string uni)
  63.         {
  64.             Console.WriteLine("The degree is {0}, is offered by {1} depertment in {2}", name, faculty, uni);
  65.         }
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment