Gradebook
Create a Gradebook program for your teacher. Each mini-lab is associated with a unit from the AP CSA course and contains a series of missions.
Mini-Lab 1 : Use Variables and Arithmetic Expressions
Mission 1 : Computing an Average
Write a program that prompts the user to enter a grade 3 times and then computes the average of these grades. Guiding questions:
- What data type should each grade variable be? What will you name these grade variables?
- Should you use integer or floating-point division to calculate the grade? Why would you want to use one type over another?
Mission 2 : Rounding Appropriately
Your teacher wants you to round the grade appropriately, does this change which type of division you are choosing to use?
Mission 3 : Random Bonus Points
Your teachers wants you to add a random number of bonus points to the sum of the grades. The random number of bonus points is between 1 and 5.
Need help? Consult the following tutorials:
- Introduction to Determining Data Types
- Naming Variables
- Declaring and Initializing Variables
- Introduction to Arithmetic Expressions
- Applying the Order of Operations
- Arithmetic Expressions and the Assignment Operator
- Introduction to Type Converstions with Casting
- Introduction to Console Input and Output
- Creating Objects and Calling Methods
- Using the Random Class
- Using the Math Class
Mini-Lab 2 : Using Selection and Iteration
Make your program more abstract by using iteration to obtain any number of grades.
Mission 1 : Use a Loop to Enter Grades
Modify the Unit 1 Gradebook program to use a loop to enter 10 grades.
Mission 2 : Prompt the User for Number of Grades
Modify the program to ask the user for the number of grades they want to enter first and then use the loop to allow that many grades to be entered.
Mission 3 : Enter Grades until -999 is Entered
Modify the program to continue to enter grades until -999 is entered. Be sure -999 is not included as part of the student average.
Mission 4 : Enter a String of grades
Instead of obtaining grades one at a time from the user, have them enter a list of grades, with each grade followed by a comma.
For example: 90,89,92,93,90,
Use String methods indexOf and substring to obtain each grade as a String and then use Integer.parseInt() to convert the String to an int.
Mission 5 : Drop Lowest Grade
Instead of adding a random number of bonus points, the teacher wants to drop the lowest grade before computing the average. Modify the program to allow for the lowest grade to be dropped.
Need help? Consult the following tutorials:
- Using Boolean Expressions and Relational Operators
- Using Logic Operators
- Using if Statements
- Using While Loops
- Using For Loops
Mini-Lab 3 : Incorporating Classes
Mission 1 : Student Class
Create a Student class. Each student should have a first name, last name, and a String of grades where each grade is followed by a comma.
Include a method to calculate the average of a Student object.
Need help? Consult the following tutorials:
Mini-Lab 4 : Array, ArrayList, and 2D Array
Mission 1 : Create Gradebook Class
Create a Gradebook class that contains an ArrayList of students and the name of the class.
Mission 2: Read Grades From a File
Create a file that contains the first name, last name, and list of grades with each grade followed by a comma. Separate the first name, last name, and grades list with a semicolon. Each student should be on their own line.
For example: Duchess;Java;90,89,92,93,90, Duke Blaze;Java;88,87,90,89,88,
Use the split method to extract the names and grades.
Mission 3 : Add printAverages Method
Add a method to Gradebook called printAverages that will print the first name of each student and their average.
Mission 4 : Add createSeatingChart Method
Add a method to Gradebook called createSeatingChart that will return a 2D array to represent a seating chart. It should have parameters for the teacher to specify the size of the room.
Need help? Consult the following tutorials:
- Constructing an ArrayList Object
- Accessing and Removing Values from an ArrayList Object
- Iterating Over an ArrayList
- Introduction to Arrays
- Iterate Over Arrays
- Reading from a Text File Using File and Scanner
- Using String split Method on Data
- Introduction to Two-Dimensional Arrays
- Iterating Over a Two-Dimensional Array