In: Computer Science
1. Create a console program in C#,
* Create a class: "Student.cs"
* Add 3 variables: StudentName (string), SchoolYear (int), YearsUntilGraduation(int)
* Method YTK() = 12 - SchoolYear;
2. Main
*Enter name
*Enter age
*You will attend school:____ years before graduating.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Student
{
class Student
{
public string StudentName;
public int SchoolYear;
public int YearsUntilGraduation;
public int age;
public int YTK(int Schoolyear)
{
int sch_year = 12- schoolyear ;
return sch_year;
}
public void data()
{
Console.WriteLine("Enter Name: ");
SName = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter Age: ");
age = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("Enter School Year: ");
SchoolYear= Console.ReadLine();
YearsUntilGraduation = YTK(SchoolYear);
}
public void Display()
{
Console.WriteLine("");
Console.WriteLine("Student's Name: {0}", StudentName);
Console.WriteLine("");
Console.WriteLine(" Age: {0}", age);
Console.WriteLine("");
Console.WriteLine("You will attend school: {0} years
before graduating.", YearsUntilGraduation);
Console.WriteLine("");
}
class Student1
{
static void Main(string[] args)
{
Student S1 = new Student();
S1.data();
S1.Display();
}
}
}
}