Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is the assignment: Lab Grades Suppose your lab instructor has a somewhat co

ID: 3639222 • Letter: H

Question

Here is the assignment:

Lab Grades
Suppose your lab instructor has a somewhat complicated method of determining your grade on a lab. Each lab consists of two
out-of-class activities—a pre-lab assignment and a post-lab assignment—plus the in-class activities. The in-class work is
60% of the lab grade and the out-of-class work is 40% of the lab grade. Each component of the grade is based on a different
number of points (and this varies from lab to lab)—for example, the pre-lab may be graded on a basis of 20 points (so a
student may earn 17 out of 20 points) whereas the post-lab is graded on a basis of 30 points and the in-class 25 points. To
determine the out-of-class grade the instructor takes the total points earned (pre plus post) divided by the maximum possible
number of points, multiplied by 100 to convert to percent; the in-class grade is just the number of points earned divided by
the maximum points, again converted to percent.
The program LabGrade.java is supposed to compute the lab grade for a student. To do this it gets as input the number of
points the student earned on the prelab assignment and the maximum number of points the student could have earned; the
number of points earned on the lab itself and the maximum number of points; the number of points earned on the postlab
assignment and the maximum number of points. The lab grade is computed as described above: the in-class and out-of-class
grades (in percent) are computed separately then a weighted average of these is computed. The program currently assumes
the out-of-class work counts 40% and the in-class counts 60%. Do the following:
1. First carefully hand trace the program assuming the input stream contains the values 17, 20, 23, 25, 12, 15. Trace the
program exactly as it is written (it is not correct but it will compile and run so the computer would not know it isn't
correct). Fill in the answers to the following questions:
a. Show exactly how the computer would execute the assignment statement that computes the out of class average for
this set of input. Show how the expression will be evaluated (the order in which the operations are performed) and
what the result will be.
b. Show how the computer would execute the assignment statement that computes the in-class average. What will the
result be?
c. Show how the computer would execute the assignment statement that computes the lab grade.



AND, here is the source code:

public class LabGrade
{
public static void main (String[] args)
{
// Declare constants
final double IN_WEIGHT = 0.6; // in-class weight is 60%
final double OUT_WEIGHT = 0.4; // out-of-class weight is 40%
// Declare variables
int preLabPts;
//number of points earned on the pre-lab assignment
int preLabMax;
//maximum number of points possible for pre-lab
int labPts;
//number of poitns earned on the lab
int labMax;
//maximum number of points possible for lab
int postLabPts;
//number of points earned on the post-lab assignment
int postLabMax;
//maximum number of points possible for the post-lab
int outClassAvg; //average on the out of class (pre and post) work
int inClassAvg;
//average on the in-class work
double 1abGrade; //final lab grade
Scanner scan = new Scanner(System.in);
// Get the input
System.out.println(" Welcome to the Lab Grade Calculator ");
System.out.print("Enter the number of points you earned on the pre-lab: ");
preLabPts = scan.nextInt();
System.out.print("What was the maximum number of points you could have earned? ");
preLabMax = scan.nextInt();
System.out.print("Enter the number of points you earned on the lab: ");
labPts = scan.nextInt();
System.out.print("What was the maximum number of points for the lab? ");
labMax = scan.nextInt();
System.out.print("Enter the number of points you earned on the post-lab: ");
postLabPts = scan.nextInt();
System.out.print("What was the maximum number of points for the post-lab? ");
postLabMax = scan.nextInt();
System.out.println();
// Calculate the average for the out of class work
outClassAvg = preLabPts + postLabPts / preLabMax + postLabMax * 100;
// Calculate the average for the in-class work
inClassAvg = labPts / labMax * 100;
// Calculate the weighted average taking 40% of the out-of-class average
// plus 60% of the in-class
labGrade = OUT_WEIGHT * outClassAvg + IN_WEIGHT * inClassAvg;
// Print the results
System.out.println("Your average on out-of-class work is " + outClassAvg + "%");
System.out.println("Your average on in-class work is " + inClassAvg + "%");
System.out.println("Your lab grade is " + labGrade + "%");
System.out.println();
}
}

Explanation / Answer

please rate - thanks


public class LabGrade
{
public static void main (String[] args)
{
// Declare constants
final double IN_WEIGHT = 0.6; // in-class weight is 60%
final double OUT_WEIGHT = 0.4; // out-of-class weight is 40%
// Declare variables
int preLabPts;
//number of points earned on the pre-lab assignment
int preLabMax;
//maximum number of points possible for pre-lab
int labPts;
//number of poitns earned on the lab
int labMax;
//maximum number of points possible for lab
int postLabPts;
//number of points earned on the post-lab assignment
int postLabMax;
//maximum number of points possible for the post-lab
int outClassAvg; //average on the out of class (pre and post) work
int inClassAvg;
//average on the in-class work
double 1abGrade; //final lab grade
Scanner scan = new Scanner(System.in);
// Get the input
System.out.println(" Welcome to the Lab Grade Calculator ");
System.out.print("Enter the number of points you earned on the pre-lab: ");
preLabPts = scan.nextInt();                                                                                           preLabPts=17
System.out.print("What was the maximum number of points you could have earned? ");
preLabMax = scan.nextInt();                                                                                           preLabMax=20
System.out.print("Enter the number of points you earned on the lab: ");
labPts = scan.nextInt();                                                                                                 labPts=23
System.out.print("What was the maximum number of points for the lab? ");
labMax = scan.nextInt();                                                                                                labMax=25
System.out.print("Enter the number of points you earned on the post-lab: ");
postLabPts = scan.nextInt();                                                                                        postLabPts=12
System.out.print("What was the maximum number of points for the post-lab? ");
postLabMax = scan.nextInt();                                                                                         postLabMax=15
System.out.println();
// Calculate the average for the out of class work
outClassAvg = preLabPts + postLabPts / preLabMax + postLabMax * 100;     outclassAvg= 1517     see below
// Calculate the average for the in-class work
inClassAvg = labPts / labMax * 100;                                                           inClassAvg =   0   see below
// Calculate the weighted average taking 40% of the out-of-class average
// plus 60% of the in-class
labGrade = OUT_WEIGHT * outClassAvg + IN_WEIGHT * inClassAvg;              labGrade= 606.8   see below
// Print the results
System.out.println("Your average on out-of-class work is " + outClassAvg + "%");
System.out.println("Your average on in-class work is " + inClassAvg + "%");
System.out.println("Your lab grade is " + labGrade + "%");
System.out.println();
}
}

outClassAvg = preLabPts + postLabPts / preLabMax + postLabMax * 100
                            17     +     12         /    20           +      15         *100
                             17 + 0 + 15 * 100
                             17 + 1500
                                  1517

inClassAvg = labPts / labMax * 100;     
                      23     / 25     * 100
                                     0*100
                            0

labGrade = OUT_WEIGHT * outClassAvg + IN_WEIGHT * inClassAvg;
                     .4                       * 1517     +   .6     *    0
                                606.8

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote