Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program is C#. Any help is greatly appreciated! You\'re going to call this

ID: 3791345 • Letter: T

Question

This program is C#. Any help is greatly appreciated!

You're going to call this project PO3StudentEmployeeEntry. For this project, you're going to create a console application with two classes in addition to the Program.cs class that's generated when you create a new Console Application project. Don't rename Program.cs. The first class will be called StudentClass and will have the following public attributes: String Name, String Major, String GraduationYear, Double GPA. The second class will be called EmployeeClass and will have the following public attributes: String Name, String Department, Double Salary. Along with the attributes for each class you'll create a constructor in which you'll pass the data in through the parameters and set the properties inthat constructor method. You're going to create a menu that gives the user options to: Add a student/Add an employee View all students View all employees /Exit. Student Employee Menu 1) Add a Student dd an Employee tudents iew 4) View a Employees 5) Exit Make a selection: If they choose view all Students or View all Employees and none have been entered, then you're going to tell them that none have been entered.

Explanation / Answer

using System;

class Student
{
   private String name;
   private String major;
   private String graduationYear;
   private double gpa;
   public Student(String name,String major,String graduationYear,double gpa) //constructor
   {
       this.name = name;
       this.major = major;
       this.graduationYear = graduationYear;
       this.gpa = gpa;
   }
   //properties
   public String StName
   {
       set{ name = value; }
       get{ return name;}
          
   }
   public String Name
   {
       set{ name = value; }
       get{ return name;}
          
   }
   public String Major
   {
       set{ major = value; }
       get{ return major;}
          
   }
   public String GraduationYear
   {
       set{ graduationYear = value; }
       get{ return graduationYear;}
          
   }
   public double GPA
   {
       set{ gpa = value; }
       get{ return gpa;}
          
   }
  
}
class Employee
{
  
   private String name;
   private String department;
   private double salary;
   public Employee(String name,String department,double salary) //constructor
   {
       this.name = name;
       this.department = department;
       this.salary = salary;
   }
   //properties
   public String EmpName
   {
       set{ name = value; }
       get{ return name;}
          
   }
   public String Department
   {
       set{ department = value; }
       get{ return department;}
          
   }
   public double Salary
   {
       set{ salary = value; }
       get{ return salary;}
          
   }
  
}
public class Test
{
  
   public static void Main()
   {
       int option = 0;
       String sname,ename,major,gYear,dept;
       double gpa,salary;
       int i,scount,ecount;
       i=scount=ecount=0;
       //Array of objects
       Student[] s = new Student[20];
       Employee[] e = new Employee[20];
       do
       {
           Console.WriteLine("*********************************");
           Console.WriteLine("Student/Employee Menu");
           Console.WriteLine("*********************************");
           Console.WriteLine("1. Add a Student");
           Console.WriteLine("2. Add an Employee");
           Console.WriteLine("3. View all Students");
           Console.WriteLine("4. View all Employees");
           Console.WriteLine("5. Exit");
           Console.WriteLine("*********************************");
           Console.WriteLine("Make a selection");
           option = Convert.ToInt32(Console.ReadLine());
          
           switch(option)
           {
               case 1: Console.WriteLine("Enter student's full name : ");
                       sname = Console.ReadLine();
                       if(sname == " ")
                       Console.WriteLine("Your answer cannot be empty. Please try again");
                       Console.WriteLine("Enter student's full name : ");
                       sname = Console.ReadLine();
                       Console.WriteLine("Enter student's major : ");
                       major = Console.ReadLine();
                       Console.WriteLine("Enter student's Graduation year : ");
                       gYear = Console.ReadLine();
                       Console.WriteLine("Enter student's GPA : ");
                       gpa = Convert.ToDouble(Console.ReadLine());
                       s[i] = new Student(sname,major,gYear,gpa);
                       scount++;
                       Console.WriteLine("Student added. Press any key to continue");
                       break;
                      
               case 2: Console.WriteLine("Enter employee's full name : ");
                       ename = Console.ReadLine();
                       if(ename == " ")
                       {
                       Console.WriteLine("Your answer cannot be empty. Please try again");
                       Console.WriteLine("Enter employee's full name : ");
                       sname = Console.ReadLine();
                       }
                       Console.WriteLine("Enter employee's department : ");
                       dept = Console.ReadLine();
                       Console.WriteLine("Enter employee's salary : ");
                       salary = Convert.ToDouble(Console.ReadLine());
                       if(salary == 0)
                       {
                       Console.WriteLine("This is not a valid number.Please try again");
                       Console.WriteLine("Enter employee's salary : ");
                       salary = Convert.ToDouble(Console.ReadLine());
                       }
                       e[i] = new Employee(ename,dept,salary);
                       ecount++;
                       Console.WriteLine("Employee added. Press any key to continue");
                       break;
              
               case 3: Console.WriteLine("View Students");
                        Console.WriteLine("****************************************************************");
                        if(scount == 0)
                        Console.WriteLine("You have not added any students yet");
                        else
                        {
                        Console.WriteLine("Name Major Graduation Year Grade Point Average");
                       Console.WriteLine("****************************************************************");
                       for(i=0;i<scount;i++)
                       {
                           Console.WriteLine(s[i].Name+" "+ s[i].Major+" "+ s[i].GraduationYear +" "+ s[i].GPA);
                       }
                        }
                       break;
               case 4: Console.WriteLine("View Employees");
                        Console.WriteLine("****************************************************************");
                    
                       if(scount <= 0)
                        Console.WriteLine("You have not added any students yet");
                        else
                        {
                        Console.WriteLine("Name Department   Salary");
                       Console.WriteLine("****************************************************************");
                       for(i=0;i<scount;i++)
                       {
                           Console.WriteLine(e[i].EmpName+" "+ e[i].Department+" "+ e[i].Salary +" "+ s[i].GPA);
                       }
                        }
                       break;
              
               case 5: break;
              
              
           }
           Console.WriteLine("Make a selection");
           option = Convert.ToInt32(Console.ReadLine());
       }while(option == 5);
   }
}

output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote