Assignment 5.3: Arrays and Student Grades
Store student grades in an arrayGoals
The goals of this assignment are to learn the following:
- How to instantiate an Array data structure
- How to create, add, and get items in an array
- How to use Arrays as parameters
- How to design and use classes
Computer Science Principles Curriculum
- Big Idea: Algorithms: EK 4.1.1A, EK 4.1.1B, EK 4.1.1C, EK 4.1.1D, EK 4.1.1E, EK 4.1.1F, EK 4.1.1G, EK 4.1.1H, EK 4.2.1A, EK 4.2.1B
- Big Idea: Programming: EK 5.1.2A, EK 5.1.2B, EK 5.2.1A, EK 5.2.1B, EK 5.2.1C, EK 5.2.1D, EK 5.2.1E, EK 5.5.1A, EK 5.5.1D
Common Core Standards
- English Language Arts Standards » Science & Technical Subjects: CCSS.ELA-Literacy.RST.9-10.3, CCSS.ELA-Literacy.RST.9-10.4, CCSS.ELA-Literacy.RST.9-10.5, CCSS.ELA-Literacy.RST.9-10.7, CCSS.ELA-Literacy.RST.9-10.10, CCSS.ELA-Literacy.RST.11-12.2, CCSS.ELA-Literacy.RST.11-12.3, CCSS.ELA-Literacy.RST.11-12.4, CCSS.ELA-Literacy.RST.11-12.5, CCSS.ELA-Literacy.RST.11-12.10
- Mathematics Content: High School Functions » Building Functions: CCSS.Math.Content.HSF.BF.1A
- Standards For Mathmatical Practice: CCSS.Math.Practice.MP1, CCSS.Math.Practice.MP2, CCSS.Math.Practice.MP4, CCSS.Math.Practice.MP5, CCSS.Math.Practice.MP6, CCSS.Math.Practice.MP7, CCSS.Math.Practice.MP8
Overview
In the StudentGrades application you will practice storing values in arrays and continue practicing object-oriented programming. First create a Quorum class named Student under the 'New File' menu option. You will also need a new blank application with your main.quorum file. In this class you will store the name of the student, the max possible score the student can get, and an array of scores the student has received on assignments. For this project you will assume each student only has 5 scores, each worth 100 points. This means the max possible score is 500 points. In addition to these class variables you will need to define the following actions in the Student class:
use Libraries.Containers.Array
class Student
//define class variables here
//sets the student name
action SetName(text name)
end
//get the student name
action GetName returns text
end
//set the scores for the student
action SetScores(Array scores)
end
//Returns the students overall grade in the class
//An A is 90 to 100 percent, a B is 80 to 89 percent,
//a C is 70 to 79 percent, a D is 60 to 69 percent, and
//an F is anything lower than 60 percent
action GetFinalGrade returns text
return ""
end
//a private action to help you calculate the total points
//a student has (stored in the scores array).
private action GetPointTotal returns number
integer totalPoints = 0
//your code here
return totalPoints
end
//a private action that gets the final percentage a student
//has in the class (their total points/ max points possible).
private action GetFinalPercentage returns number
number value = 0
return value
end
end
In main.quorum you will need to define two arrays: one to store Student objects and another to store grades, an integer. Once you have defined these arrays you can start to construct each student and their grades. Define two students with the names and grades listed below:
Students
- Jenny: 92,100, 95, 88, 79
- John: 73, 91, 87, 88, 95
Once this information is stored you can loop through the Array of students and output some basic information. The program should produce output that does the following:
- Get the student from the array.
- Output or say the student name and the array index the student was found at.
- Calculate the student's grade.
- Output or say the grade of the student
Sample Output
student jenny is at array index 0
jenny's grade is a A
student john is at array index 1
john's grade is a B
Design Criteria
- Create a new project and name it StudentGrades.
- There should be a total of 2 files:
- main.quorum
- Student.quorum
- Each file should have the corresponding class defined in the file.
- Use appropriate variables to store and keep track of values (including class variables).
- You should implement each action given in the assignment specification.
Next Tutorial
In the next tutorial, we will discuss Classes, which describes how work classes in Quorum..