{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

This preview shows page 1. Sign up to view the full content.

Lab Grade Trace Answers to Question 1: The values of the variables after being read in are: preLabPts = 17 preLabMax = 20 labPts = 23 labMax = 25 postLabPts = 12 postLabMax = 15 a. Execution of outClassAvg = preLabPts + postLabPts / preLabMax + postLabMax * 100; Multiplication and division have highest precedence and are evaluated left to right so the division is the first operation performed. The variables postLabPts and preLabMax are both integers so integer division would be used. Hence the first calculation is 12 / 20 which equals 0 The next operation is the multiplication: postLabMax * 100 = 1500
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Finally, the two additions are performed left to right: 17 + 0 + 1500 = 1517 b. Execution of inClassAvg = labPts / labMax * 100; Division and multiplication have the same precedence so evaluation is left to right. All operands are integers so integer division is used. Hence the evaluation is as follows: inClassAvg = (23 / 25) * 100 = 0 * 100 = 0 c. Execution of labGrade = OUT_WEIGHT * outClassAvg + IN_WEIGHT * inClassAvg; is as follows: labGrade = (0.4 * 1517) + (0.6 * 0) = 606 + 0 = 606.8 Question 3: Corrected Program...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern