using System namespace Test Description of Student publi

using System; namespace Test { ///

/// Description of Student. ///

public class Student { string Name, Address, Phone, Email, Major; double GPA; public Student() { Name=\"\"; Address=\"\"; Phone=\"\"; Email=\"\"; Major=\"\"; GPA=0; } public void setGPA(double gpa) { GPA=gpa; } public double getGPA() { return GPA; } public void setMajor(string major) { Major=major; } public string getMajor() { return Major; } public void setPhone(string phone) { Phone=phone; } public string getPhone() { return Phone; } public void setAddress(string address) { Address=address; } public string getAddress() { return Address; } public void setEmail(string email) { Email=email; } public string getEmail() { return Email; } public void setName(string name) { Name=name; } public string getName() { return Name; } } } Above is student class Part #1: Create the Person class first. Part #2: Modify the Student class to use the Person class Part #1 - Create the Person class. Go to the Menu and select project. Under project, select Add class. Then start typing in your code for a Person class. Properties: Name, Address, Phone, Email. Behaviors: set and get methods, Display(outputs all person data to the Output window using Console.WriteLine()). Part #2 – Modify the Student class that you created in the last lab to use the new Person class. Indicate that the Student class inherits from the Person class. Remove any properties that are already in the Person class. Modify the constructors and the display method, to use code from the Person class.

Solution

public class Person {

     string Name, Address, Phone, Email;

     public void setPhone(string phone) { Phone=phone; }

     public string getPhone() { return Phone; }

     public void setAddress(string address) { Address=address; }

     public string getAddress() { return Address; }

     public void setEmail(string email) { Email=email; }

     public string getEmail() { return Email; }

     public void setName(string name) { Name=name; }

     public string getName() { return Name; }

     public PersonPrint() { Console.WriteLine(Name);Console.Writeline(Address);Console.Writeline(Phone);Console.Writeline(Email);

    }

}

public class Student: public Person {

      String Major;

     double GPA;

     public Student() { Name=\"\"; Address=\"\"; Phone=\"\"; Email=\"\"; Major=\"\"; GPA=0; }

     public void setGPA(double gpa) { GPA=gpa; }

     public double getGPA() { return GPA; }

     public void setMajor(string major) { Major=major; }

     public string getMajor() { return Major; }

}

using System; namespace Test { /// /// Description of Student. /// public class Student { string Name, Address, Phone, Email, Major; double GPA; public Student(
using System; namespace Test { /// /// Description of Student. /// public class Student { string Name, Address, Phone, Email, Major; double GPA; public Student(

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site