Question: This is what I have so far: Main File: using System; namespace Math { class Program { static void Main(string[] args) { //initializing variables int

This is what I have so far:

Main File:

using System;

namespace Math { class Program { static void Main(string[] args) { //initializing variables int A1, B2, C3; //printin the name Console.Write("Put Ya Name:"); //getting string input from the user string name = 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); } } }

Secondary File:

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

namespace Student { 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); }

} }

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.

-Thank You!

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!