Description

Introduction

The purpose of this lab is to use what we’ve learned about using conditionals to write a program that computes a student’s chance of being accepted for transfer to a university.

Procedure

As usual, create a script, include a comment at the top explaining the purpose of the script, your name, and the date it was created.

A. Suppose four students are applying to the College of Engineering at TNRU (Totally Not Real University). Each student has the attributes: Major, GPA and SAT score. Encoding for the majors are below. Write a function called identifyMajor that takes as input the student (student will be in array form that contains the attributes listed above), uses a switch statement to determine the major of the student and returns as output the decoded major in string form.

1 = Aeronautical/Astronautical Engineering

2 = Chemical Engineering

3 = Civil Engineering

4 = Electrical Engineering

5 = Environmental Engineering

6 = Mechanical Engineering

B. In order to determine if a student will be admitted to their chosen major, we need to compare their GPA and SAT scores to the average GPA and SAT scores for their department. Write a function called computeAdmissionStatus that takes in as input the student array and implements the following decision:

  • If student GPA and student SAT score are both greater than or equal to the average GPA and SAT score for the department, then admissionStatus = ‘admitted’
  • If student GPA and student SAT score are both less than or the average GPA and SAT score for the department, then admissionStatus = ‘denied’
  • If student GPA is less than the average department GPA but the student SAT score is greater than or equal to the average SAT score for the department, or is student SAT score is less than the average department SAT score but the student GPA is greater than or equal to the average GPA for the department, then admissionStatus = ‘pending.’

The average department GPA and SAT scores are as follows:

Aeronautical/Astronautical Engineering:

Average GPA: 3.59

Average SAT Score: 1148

Chemical Engineering:

Average GPA: 3.74

Average SAT Score: 1164

Civil Engineering:

Average GPA: 3.65

Average SAT Score: 1132

Electrical Engineering:

Average GPA: 3.72

Average SAT Score: 1160

Environmental Engineering:

Average GPA: 3.67

Average SAT Score: 1158

Mechanical Engineering:

Average GPA: 3.71

Average SAT Score: 1156

C. Write a main function from where you will declare variables and call the functions you wrote above. Create three student arrays by copying the following code into your main function:

studentA = [2,3.79,1165];
studentB = [4,3.7,1156];
studentC = [5,3.69,1150];
studentD = [6,3.55,1172];

Your main function should also report the admission status of each student to the user. As in the last lab, display a sentence with the outputs embedded in an array of strings. See the page on Displaying Output Messages with Variables. For example, your output message should be in the form: ‘Student A’s admission the the Electrical Engineering Department is pending.’

Turn-in Instructions

You will need to submit .m files for each function you define. Each .m file should include your name and function description in comments. Upload your files via Canvas. Let me know if you have any questions