Question: This is what I have so far in C#: //Student class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication47 { class

This is what I have so far in C#:

//Student class

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace ConsoleApplication47 { class Student {

// ATTRIBUTES

private string firstName; // A private variable, accessible on within the Student class, to store the first name. private string lastName; // As above, for last name. private double gpa; // As above, for GPA. These variables should be accessed, internally and externally, // through the accessor GET and SET methods in the associated properties below. // PROPERTIES

public string FirstName // A property associated with the firstName attribute above. { get // This get method will be used anytime we attempt to access the value stored in the { // via this property. Because we are working only with simple types, we do something return firstName; // such as return firstName. For more complicated types later, this may be more complicated. } set // The set method will be used anytime we attempt to save a value into this property. { firstName = value; // With our simple types, we can do this as simply as assigning the keyword VALUE to the } // associated variable. }

public string LastName // A property associated with (and used for GETting and SETting) the lastName attribute. { get { return lastName; } set { lastName = value; } }

public double GPA // A property associated with (and used for GETting and SETting) the gpa attribute. { get { return gpa; } set { gpa = value; } } // CONSTRUCTORS

public Student() // Default constructor, for creating a blank Student object. { }

public Student(string first, string last) // Overloaded Constructor to set first and last name initially. { FirstName = first; // Note use of property for set accessor, despite the attribute being a class member. LastName = last; // This ensures we know exactly how our data is being manipulated. }

public Student(string first, string last, double gpa) // Overloaded Constructor to set first and last name, as well as GPA initially. { FirstName = first; LastName = last; GPA = gpa; }

// METHODS

public void DisplayStudentInfo() { Console.Write(" ");

Console.WriteLine("Student Name: {0} {1} ", FirstName, LastName); Console.WriteLine("GPA: {0}", GPA); }

} }

=====================================================================================

//Program class

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace ConsoleApplication47 { class Program { static void Main(string[] args) { //initializing variables int A1, B2, C3;

//printin the name Console.Write("Put First Name:"); //getting string input from the user string firstname = Console.ReadLine();

// getting string input from the user Console.Write("Put Last Name:"); string lastname = Console.ReadLine();

//printing Assignment Score-1 Console.Write("Enter Assignment Score-1:"); //getting integer input from the user A1 = Convert.ToInt32(Console.ReadLine()); //printing Assignment Score-2 Console.Write("Enter Assignment Score-2:"); //getting integer input from the user B2 = Convert.ToInt32(Console.ReadLine()); //printing Assignment Score-3 Console.Write("Enter Assignment Score-3:"); //getting integer input for the user C3 = Convert.ToInt32(Console.ReadLine()); //calculating float average of three numbers float avg = (float)(A1 + B2 + C3) / 3; //rounded Average upto two decimal points and printing Average //Console.Write(" {0}'s Average is {1:0.00}", name, avg);

//student object //default constrcutor Student s = new Student(); s.FirstName = firstname; s.LastName = lastname; s.GPA = avg; s.DisplayStudentInfo();

//parametrized constrcutor with 3 parameters Student s1 = new Student("j","wilson", 88); s1.DisplayStudentInfo();

//parametrized constrcutor with 2 parameters Student s2 = new Student("alain", "chrule", 86); s2.DisplayStudentInfo();

Console.ReadLine();

} } }

I need it to ask the user to enter the names and grades of 3 students. It needs a new class to store the information of each of the three students, complete with attributes for Names, Grades, and Averages and properties for GETting and SETting those values, Constructors for initializing new Student objects with either no information or their name already set, and a method for calculating and displaying the average.

I need it to repeat the step where it asks for the names and the grades three times, displays it accordingly, and It needs to look like this. I cannot for the life of me figure it out, please help.

This is what I have so far in C#: //Student class using

-Thank You!

file:///c/users/silcox_4231/documents/visual studio 2012/Projects/Lab3_Demo/Lab3_Demo/bin/D... Enter a grade for Jason's second assignment:95.5 Enter a grade for Jason's third assignment:99 Enter a name for Student 2: Sofia Enter a grade for Sofia's first assignment:85.6 Enter a grade for Sofia's second assignnent:88.8 Enter a grade for Sofia's third assignment:94.4 Enter a name for Student 3: Joseph Enter a grade for Joseph's first assignment:25.5 Enter a grade for Joseph's second assignment:84.4 Enter a grade for Joseph's third assignment:100 Jason's Average : 94.8333333333333 Sofia's Average: 89.6 Joseph's Average: 86.6333333333333 Press any key to continue

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!