Starting from:

$34.99

MAP523 Assignment 1 Solution

Group Size
This is an individual assessment.
See course webpage
Submission Checklist
❏ You should submit the following files: main.swift file

❏ Student.swift
❏ Course.swift
❏ Transcript.swift
❏ UndergraduateTranscript.swift
❏ PostgraduateTranscript.swift
❏ Compress your files into a single zip file. Other compressed file formats (7zip, rar) will not be graded.
❏ Learners using XCode can simply zip the entire XCode project (.xcodeproj file + folder containing your swift files)
❏ Name your zip file: a1-studentname-studentid.zip. Replace studentname,studentid with your name and id.
Learners are reminded that using full or partial solutions found on the Internet is not permitted.
Business Requirements
1. Students
Undergraduate students are graded using the GPA scale.
Postgraduate students are graded based on Pass/Fail criteria.
2. Courses
The student transcript records a list of all the courses a student takes. Each course has a course title and the grade the student received in a course.
A student can only take a course once. Attempting to take the course more than once is not permitted.
3. Transcripts
Every student has a transcript. All transcripts display the following information:
1. The student’s personal information (name, id, undergraduate/postgraduate)
2. The list of courses the student took
3. The grade they received in each course. There are two possible ways to display the grade:
○ For undergraduate students, the grade is shown as a percentage out of 100 (eg: 85)
○ For graduate students, the grade is shown as Pass/Fail
In addition, an undergraduate student transcript must display the student’s overall GPA out of 4. Postgraduate student transcripts do not contain a GPA.
Example of an undergraduate student transcript:
Student Name: Laura Diaz
Student ID: 771522
Student Type: Undergraduate
Algebra 94
English in Pop Culture 49
Intro to Biology 75
GPA: 2.0
Example of a postgraduate student transcript:
Student Name: Nelle
Student ID: 779988
Student Type: Postgraduate
Statistics FAIL
Creative Problem Solving PASS
4. Grading Criteria
Undergraduate Students:
The GPA of an undergraduate student is based on their average grade across all courses. The grade is then converted to a GPA score out of 4, per the chart below:
Average (%) GPA
90-100 4
80-89.9 3.0
70-79.9 2.0
60-69.9 1.2
0-59.9 0
Graduate Students
Graduate students are graded on a PASS/FAIL criteria.
A graduate student passes or fails a course based on the following criteria:
Grade (%) Pass/Fail
50-100 Pass
< 50 (less than 50) Fail
Implementation Details
Your program must be developed from an object oriented perspective and conform to the following design.

IsPrintable
1. A protocol containing a single function, called show()
2. The Student and Transcript data types conform to this protocol.
Student
1. The Student class has the following properties:
● id (string)
● first name (string)
● last name (string optional)
● full Name (computed property, String)
● type (String enumeration)
2. The full name of a student depends on whether they have a last name.
● If the learner has a last name, then their full name consists of their first name and last name, separated by a space (eg: Peter Smith)
● If the learner does not have a last name, then their full name consists of only their first name (eg: Peter)
3. Conforms to the IsPrintable protocol. The show() function should output the student’s full name, id, and type, like this:
Student Name: Laura Diaz
Student ID: 771522
Student Type: Undergraduate Studies
Course
1. Courses must be modelled as a class with no explicit initializer.
2. All courses have the following properties:
● Course Title, eg: Intro to Biology (string)
● Grade received in the course, out of 100 (double)
Transcript
1. The Transcript class is the superclass of UndergraduateTranscript and PostGraduateTranscript data types.
2. Contains a student and list of courses.
3. The class contains the following functions:
addCourse(): This function adds a course to the student’s transcript. The function must outputs a confirmation message indicating that the course has been added.
show(): Inherited from the IsPrintable protocol. Outputs the student’s information, the list of courses, and the grade in each course (out of 100) to the screen. Student information should be output using the Student’s show() function. Example:
Student Name: Laura Diaz
Student ID: 771522
Student Type: Undergraduate
Algebra 94
English in Pop Culture 49
Intro to Biology 75
UndergraduateTranscript:
1. Must be modelled as a class that inherits from the Transcript data type.
2. Contains a single computed property called gpa. This property calculates the GPA of the student associated with the transcript.
3. Must override the parent class’ show() function by outputting the transcript and the calculated GPA. Example:
Student Name: Laura Diaz
Student ID: 771522
Student Type: Undergraduate
Algebra 94
English in Pop Culture 49
Intro to Biology 75
GPA: 2.0
PostgraduateTranscript:
1. Must be modelled as a class that inherits from the Transcript data type.
2. Must override the parent class’ show() function by outputting the transcript for a postgraduate student.
Student Name: Nelle
Student ID: 779988
Student Type: Postgraduate
Statistics FAIL
Creative Problem Solving PASS
Main.swift File
To demonstrate the correctness of your design, provide a main.swift file that performs the following actions:
1. Create an Undergraduate student with a first name and last name 2. Create a Postgraduate student with a first name, but no last name
3. Create 5 courses and assign grades to each course.
4. Create a transcript for the undergraduate student. Add 3 of the courses to the transcript.
5. Create a transcript for the postgraduate student. Add 2 of the courses to the transcript.
6. Print out the transcript for both the Post and Undergraduate Student by calling each transcript’s respective show() function

More products