The goal for this lab is to build your own final grade
calculation program by applying your lessons learned and knowledge gained up to
this point in the semester. Completing this lab will
●
This is a one day lab to be completed by yourself and
submitted by the end of lab. If you get stuck, complete the following prior to
raising your hand:
○
Review your notes taken from lecture as most of the
topics used in this lab were covered.
○
Review previous labs as they will serve as solid
examples for the code you are using today.
○
Look up your issue in the book or research on the
internet information about how to resolve the issue.
●
Attendance in the lab is required. Failure to attend
will result in a decrease in grade.
In this lab, you are going to
create three classes, two of them are
started for you. The following are those classes and expectations/requirements
for each class:
1.
GradeCalcMain
●
Declare and instantiate(create) StudentInfo
2.
StudentInfo
●
Declare and assign variables needed to calculate best
and possible class average
●
Import and use the Scanner class
3.
GradeCalculator
●
Empty constructor
●
A public BestAverage method that returns a double
●
A public PotentialAvg method that returns a double
1.
Create a new folder, GradeCalculator
2.
Download
GradeCalcMain and
StudentInfo
a. Add a comment at the top of each class to reflect its purpose. Main should present the goal of the entire system.
3.
Save StudentInfo
with a different name (Save As), GradeCalculator.
a.
Change the class name and the constructor name to
GradeCalculator (class name and file
name must match)
b.
Update the comments
4.
At this point you should have 3 java files in your
folder.
5.
Compile and test. If you received any errors, fix them
before proceeding.
6.
In your
GradeCalcMain public static void main, declare and instantiate (create) the
studentInfo object.
a.
Compile and test. You should receive no errors.
7.
In your
StudentInfo class, you will be asking a user what their midterm score was,
what their current lab average is, and what grades they might receive for the rest of
the class to obtain an average. To this end, import, declare, assign, print or
println, instantiate (create), etc
the following:
{Compile and test often}
a.
import java.util.Scanner;
b.
Declare and instantiate the Scanner class
i.
private Scanner scanObj;
ii.
scanObj = new Scanner(System.in);
c.
Declare double variables for the following:
i.
A midterm score
- to be input by student and used for calculation by a method
ii.
A lab average
- to be input by student and used for calculation by a method
iii.
The best
possible class average - to be returned by a method that does the
calculation and once returned, presented to user
iv.
Possible
remaining lab average - to be input by student and used for calculation
v.
Possible exam
score - to be input by student and used for calculation
vi.
Calculated
average - to be returned by a method that does the calculation and once
returned, presented to user
d. Declare and instantiate your GradeCalculator object. This is still in StudentInfo.
8.
In your
GradeCalculator() constructor, add nothing as this will be an empty
constructor.
9.
In your
GradeCalculator class, create the following public methods
(below the
constructor but in the class).
a.
A public BestAverage method {function} that accepts the midterm score as a
double and the lab average as a double and returns the best possible score the
student can obtain (this will also be a double).
i.
In this method, use the passed in variables to calculate
the best possible score. One means to calculate this score could be:
(200 + mid + lab) / 4
b.
A public PotentialAvg method {function} that accepts four double variables:
midterm score, lab average, possible exam score, and the second half lab
average. The method returns the calculated average.
i.
In this method, use the passed in variables to calculate
a potential average. This allows the user to try different values and see the
result on their class grade..) One means to calculate this score:
( mid + lab1 + exam + lab2) / 4
10.
In your
StudentInfo class, accomplish the following in the constructor:
a.
Present a message to the student asking for their
midterm score (using print or println)
b.
Assign the score by using
scanObj.nextDouble()
c.
Present a message to the student asking for their lab
avg
d.
Assign the avg by using
scanObj.nextDouble()
e.
Use dot notation with your previously instantiated
GradeCalculator object to calculate the student's best possible score
i.
Don't forget that you will need to pass in some
variables
ii.
Also, don't forget a double is returned and you will
need to assign this returned double to a variable
f.
Present a message to the student of what their best
possible course score will be
i.
Something like "The best avg you can obtain is 92%."
g.
This next step is used to experiment with the possible
average based on the rest of the labs and the final exam. So, present two
messages to obtain (and assign) that information. Something like:
i.
"Enter your possible exam score.”
ii.
"Enter your possible remaining lab average."
h. Use dot notation with your previously instantiated GradeCalculator object to calculate the potential class average
i.
Don't forget that you will need to pass in some
variables
ii.
Also, don't forget a double is returned and you will
need to assign this returned double to a variable
i.
Create an if else statement based on what is returned
from the previous step
i.
If the number is greater than or equal to 60, inform the
student what that number is with something like the following:
ii.
"Your average will be 70% if you make 65 on the final
and average 80% on the rest of the labs."
iii.
If the number is less than 60 inform the student of the
average and encourage them that they will need to do better than the entered
grades to pass the class.
1.
Email me the three java files you created today
a.
The email must include:
■
The standard email subject with your details supplied:
●
CSCI 151_ Lab12_ LabTime_Student Name
■
The three files you created today.
■
A screenshot/snippet of your command window
3.
Show your running program and the code.