Question: Create a console project, create two cs files. Create a Student.cs class ( 5 % ) . Do followings in Student class. Declare these data

Create a console project, create two cs files.
Create a Student.cs class (5%). Do followings in Student class.
Declare these data members:
1. a static int Count. (15%)
2. a private static readonly Random variable rnd.(15%)
private static readonly Random rnd = new Random();
3. private string firstName, lastName, int sID, create public properties for these three data members. (20%)
4. Two constructors
a). Constructor 1: public Student(string first , string last , int id)(20%)
----this constructor set values for firstName, lastName, sID, and increase Count value by 1.
b). Constructor 2: public Student(string first="", string last ="")(20%)
----This constructor set values for firstName, lastName, and increase Count value by 1.
----Create StudentID by calling rnd.Next(1000,9999).
----Note this constructor is called when
Student s1= new Student();
Student s2= new Student("Peter");
Student s3= new Student("Morgan", "Simmons");
Create "Program.cs" to have: (5%)
Student s1= new Student();
s1.FirstName = "John";
s1.LastName = "Smith";
s1.StudentID =2560;
Student s2= new Student("Peter");
Student s3= new Student("Morgan", "Simmons");
Student s4= new Student("James", "Walters");
Student s5= new Student("Linda", "Scott", 1005);
Console.WriteLine();
Console.WriteLine("Total students: {0}", Student.Count);
//use Console.WriteLine to display s1, s2, s3, s4, s5 Name and Student ID.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!