Question
Create a program in C# 1. Create an abstract class Student.cs. o 3 public string data members: firstName, lastName, studentID. o Create a constructor to
Create a program in C#
1. Create an abstract class Student.cs.
o 3 public string data members: firstName, lastName, studentID.
o Create a constructor to initialize each data member value.
o Create read-only property for each data member.
o Create an abstract method ImportantThing(), returns string.
2. Create an Interface IMathClass.cs. Declare a method Math(), returns string.
3. Create classes ElementarySchoolStudent.cs, MiddleSchoolStudent.cs,
HighSchoolStudent.cs, CollegeStudent.cs, inherit Student.cs and IMathClass.cs to each
of them.
ElementarySchoolStudent.cs
o Constructor with three parameters for firstName, lastName, studentID.
o ImportantThing() returns "Farm field trip!".
o Math() returns "Basic Math."
o Override toString().
MiddleSchoolStudent.cs
o Constructor with three parameters for firstName, lastName, studentID.
o ImportantThing() returns "Summer Camp!".
o Math() returns "Geometry."
o Override toString().
HighSchoolStudent.cs
o Constructor with three parameters for firstName, lastName, studentID.
o ImportantThing() returns "SAT exam.".
o Math() returns "Basic Algebra."
o Override toString().
CollegeStudent.cs
o Constructor with three parameters for firstName, lastName, studentID.
o ImportantThing() returns "Major.".
o Math() returns "Advanced Algebra.".
o Override toString().
4. In Program.cs, in method main(), create an Student type array with size of 4.
o First element is ElementarySchoolStudent object with any first name, last name, student
ID for constructor.
o Second element is MiddleSchoolStudent object with any first name, last name, student
ID for constructor.
o Third element is HighSchoolStudent object with any first name, last name, student ID for
constructor.
o Fourth element is CollegeStudent object with any first name, last name, student ID for
constructor.
o for loop to go through array, call .toString for each object.
OTPUT
Ny name is Sanuel Clark, an an Elenentary school student, Will have an exciting Farm field trip!, Iwill learn Basic Math name is David Hunt, I am a niddle school student. vill have aSunner Carp!, I will learn Geometry, My name is Mary Anderson, I an high school student. I will take SAT exam,, I learn Basic Algebra, My name is Tim Russell, I am a college student, I have a Major,, I learn Advanced Algebra, Press any key to continue Student FirstName IMath Class Last Name String Math() StudentID abstract importantThing0 Middle SchoolStudent High SchoolStudent CollegeStudent Elementary SchoolStudent FirstName FirstName FirstName FirstName LastName Last Name Last Name LastName StudentID StudentID StudentID StudentID ImportantThing0 ImportantThing0 ImportantThing0 ImportantThing0 Math() Math() Math() Math()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started