Question

In: Computer Science

In the C# programming language... Write a program to perform student record manage for class IST311....

In the C# programming language...

Write a program to perform student record manage for class IST311. Create student record class (Student.cs) and it should get the student information from the user and set up student record class. The program will perform recording student’s grade information and compute final grade, and then print out the student’s class information. Student class definitions: It should contain attributes as following: first name, last name, 5 labs grade, 3 grade, final grade. Its member functions are default constructor, 2 regular constructors, display student’s information and override ToString(), which only display class type, last name, first name, and final grade. (Note: labs grade and grade are store in an array with 8 elements) Student class implementation: Your implementation: All base attributes (fields) to store student’s information. Default constructor: set student class variables to default value. String variables set to “None”, double variable set to 0, and all elements in the array set to 0. Two regular constructors: one, set student class variables in student information by different number of pass in parameter list; another set student information use pass in object. Compute grade: base on the % of final grade to compute final grade. Labs grade is 50% of final grade 1 and 2 are 15% of final grade 3 is 20% of final grade Display: print out student’s information in following sequence: Last name, First name each grade each labs grade final grade Main program (StudentReeord.cs for testing your Student class only): The main program begins with ask the user to enter input student information, then storing information into a student class variable. Compute student’s final grade for each student, who enter by the user. Next, print out each student’s information use student class displayAllGrade( ) function. Output Example: LastName, FirstName 1 2 3 lab1 lab2 lab3 lab4 lab5 final Anderson, Baily 67 89 75 92 83 78 68 67 77.2 LastName, FirstName 1 2 3 lab1 lab2 lab3 lab4 lab5 final Thomas, Daily 99 88 77 66 55 44 33 22 65.45 Your project should have two .cs file, which are StudentRecord.cs and Student.cs.

Thanks!

Solutions

Expert Solution

Short Summary:

  • Implemented StudentRecord.cs and Student.cs files using C# - Console application.
  • You can adjust the StudentRecord method, if you want to include more students

Source Code:

Student.cs File:

using System;

namespace StudentDemo

{

    class Student

    {

        // Constants

        private const int TOTAL_GRADES = 8;

        //private attributes

        private string firstName;

        private string lastName;

        private double[] grades;

        private double finalGrade;

        /// <summary>

        /// Default constructor

        /// </summary>

        public Student()

        {

            this.firstName = "None";

            this.lastName = "None";

            this.finalGrade = 0;

            // Set all grades to zero

            grades = new double[TOTAL_GRADES];

            for(int index = 0; index < grades.Length; index++)

            {

                grades[index] = 0;

            }

        }

        /// <summary>

        /// Constructor

        /// student class variables in student information by different number of pass in parameter list;

        /// </summary>

        public Student(string fname, string lname, double lab1, double lab2, double lab3, double lab4, double lab5,

            double grade1, double grade2, double grade3)

        {

            this.firstName = fname;

            this.lastName = lname;

            grades = new double[TOTAL_GRADES];

            this.grades[0] = lab1;

            this.grades[1] = lab2;

            this.grades[2] = lab3;

            this.grades[3] = lab4;

            this.grades[4] = lab5;

            this.grades[5] = grade1;

            this.grades[6] = grade2;

            this.grades[7] = grade3;

            // Compute final grade

            ComputeGrade();

        }

        /// <summary>

        /// Constrctor

        /// set student information use pass in object.

        /// </summary>

        /// <param name="other"></param>

       public Student(Student other)

        {

            this.firstName = other.firstName;

            this.lastName = other.lastName;

            this.grades = other.grades;

            this.finalGrade = other.finalGrade;

        }

        /// <summary>

        /// Compute grade: base on the % of final grade to compute final grade.

        /// </summary>

        private void ComputeGrade()

        {

            // Calculate lab grades

            double labGrades = 0;

            for(int index = 0; index < 5; index++)

            {

                labGrades += grades[index];

            }

            labGrades = labGrades / 5;

            //Labs grade is 50% of final grade 1 and 2 are 15% of final grade 3 is 20% of final grade

            this.finalGrade = (labGrades * 50 / 100) + (grades[5] * 15 / 100) + (grades[6] * 15 / 100) +

                 (grades[7] * 30 / 100);

        }

        /// <summary>

        /// print out student’s information in following sequence:

        /// Last name, First name each grade each labs grade final grade

        /// </summary>

        public void displayAllGrade()

        {

            string allGrades = "";

            for(int index = 0; index < grades.Length; index++)

            {

                allGrades += grades[index] + " ";

            }

            Console.WriteLine(this.lastName + ", " + this.firstName + " " + allGrades + " " + this.finalGrade.ToString("0.00"));

        }

        /// <summary>

        /// override ToString(), which only display class type, last name, first name, and final grade.

        /// </summary>

        /// <returns></returns>

        public override string ToString()

        {

            return this.GetType() + " " + this.lastName + " " + this.firstName + " " + this.finalGrade.ToString("0.00");

        }

    }

}

StudentRecord.cs File:

using System;

namespace StudentDemo

{

    class StudentRecord

    {

        static void Main(string[] args)

        {

            // Get names

            Console.Write("Enter Student's First Name: ");

            string firstName = Console.ReadLine();

            Console.Write("Enter Student's Last Name: ");

            string lastName = Console.ReadLine();

            double lab1 = 0, lab2 = 0, lab3 = 0, lab4 = 0, lab5 = 0,

                grade1 = 0, grade2 = 0, grade3 = 0;

            // Get lab grades

            for (int index = 1; index <= 5; index++)

            {

                Console.Write("Enter Lab " + index + " Grade: ");

                double lab;

                double.TryParse(Console.ReadLine(), out lab);

                if (index % 5 == 1)

                {

                    lab1 = lab;

                }

                else if (index % 5 == 2)

                {

                    lab2 = lab;

                }

                else if (index % 5 == 3)

                {

                    lab3 = lab;

                }

                else if (index % 5 == 4)

                {

                    lab4 = lab;

                }

                else if (index % 5 == 0)

                {

                    lab5 = lab;

                }

            }

            // Get grade

            for (int index = 1; index <= 3; index++)

            {

                Console.Write("Enter Grade " + index + ": ");

                double grade;

                double.TryParse(Console.ReadLine(), out grade);

                if (index % 3 == 1)

                {

                    grade1 = grade;

                }

                else if (index % 3 == 2)

                {

                    grade2 = grade;

                }

                else if (index % 3 == 0)

                {

                    grade3 = grade;

                }

            }

            // Create student object

            Student student = new Student(firstName, lastName, lab1, lab2, lab3, lab4, lab5, grade1, grade2, grade3);

            student.displayAllGrade();

            Console.ReadKey();

        }

    }

}

Sample Run:

**************************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

Please upvote the answer and appreciate our time.

Happy Studying!!!

**************************************************************************************


Related Solutions

Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user...
C# Programming Language Write a C# program ( Console or GUI ) that prompts the user to enter the three examinations ( test 1, test 2, and test 3), homework, and final project grades then calculate and display the overall grade along with a message, using the selection structure (if/else). The message is based on the following criteria: “Excellent” if the overall grade is 90 or more. “Good” if the overall grade is between 80 and 90 ( not including...
In C programming language, write the program "3x3" in size, calculating the matrix "c = a...
In C programming language, write the program "3x3" in size, calculating the matrix "c = a * b" by reading the a and b matrices from the outside and writing on the screen?
Write a C Program that uses file handling operations of C language. The Program should perform...
Write a C Program that uses file handling operations of C language. The Program should perform following operations: 1. The program should accept student names and students’ assignment marks from the user. 2. Values accepted from the user should get saved in a .csv file (.csv files are “comma separated value” files, that can be opened with spreadsheet applications like MS-Excel and also with a normal text editor like Notepad). You should be able to open and view this file...
In programming C language, write a program that creates a binary tree of words to be...
In programming C language, write a program that creates a binary tree of words to be used as a spell checking device for various text files. The list of words will come from a file “words.txt”. Your program is to read through the “words.txt” file and insert the word on that line into the tree in lexicographic order (also known as Dictionary order). Words in the file will be separated by spaces. Once this is done, your program should then...
In programming C language, write a program that creates a binary tree of words to be...
In programming C language, write a program that creates a binary tree of words to be used as a spell checking device for various text files. The list of words will come from a file “words.txt”. Your program is to read through the “words.txt” file and insert the word on that line into the tree in lexicographic order (also known as Dictionary order). Words in the file will be separated by spaces. Once this is done, your program should then...
C++ programming language. Write a program that will read in id numbers and place them in...
C++ programming language. Write a program that will read in id numbers and place them in an array.The array is dynamically allocated large enough to hold the number of id numbers given by the user. The program will then input an id and call a function to search for that id in the array. It will print whether the id is in the array or not. Sample Run: Please input the number of id numbers to be read 4 Please...
In C Programming Language Write a program to output to a text log file a new...
In C Programming Language Write a program to output to a text log file a new line starting with day time date followed by the message "SUCCESSFUL". Please screenshot the results.
Lab 1 Write a program in the C/C++ programming language to input and add two fractions...
Lab 1 Write a program in the C/C++ programming language to input and add two fractions each represented as a numerator and denominator. Do not use classes or structures. Print your result (which is also represented as a numerator/denominator) to standard out. If you get done early, try to simplify your result with the least common denominator. The following equation can be used to add fractions: a/b + c/d = (a*d + b*c)/(b*d) Example: 1/2 + 1/4 = ( 1(4)...
Kindly Do the program in C++ language Object Oriented Programming. Objectives  Implement a simple class...
Kindly Do the program in C++ language Object Oriented Programming. Objectives  Implement a simple class with public and private members and multiple constructors.  Gain a better understanding of the building and using of classes and objects.  Practice problem solving using OOP. Overview You will implement a date and day of week calculator for the SELECTED calendar year. The calculator repeatedly reads in three numbers from the standard input that are interpreted as month, day of month, days...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT