{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lab Assignment 3

Lab Assignment 3 - Program 3 Same as Program 2 except that...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab Assignment 3 Objectives: Become familiar with increment/decrement operators Become familiar with if…else statements Become familiar with switch…case statements Program 1: Write a program which illustrates that after executing c = a++ + ++b; (c == a + b) is false. A cout statement within an if…else statement can be used to print out “ true ” or false Program 2: Write a program which can be used to determine a grade using nested if… else control structures. The user inputs two numeric grades, semester grade (excluding final), and final exam grade. Based on an 80/20 weighting, an average numeric grade is calculated and output. Then a letter grade is assigned can do this by outputting before and after values, including conclusions. An if…else based on grade criteria, e.g., 90-100 A. The output should go to the monitor and should include average grade and letter grade.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Program 3: Same as Program 2, except that a switch…case statement is used to select and output the appropriate letter grade for each student based on the work performed, instead of nested if…else statements as in part B. Suggestion: your switch variable can be 1/10 of your grade, thus, a case statement might look like this: case 8: cout << “B”; break; The default: statement of the switch can be used to allocate F’s. Lab Assignment 3 Examples • Program 1. Please enter integers a and b: 22 7 After executing c = a++ + ++b; a = 23; b = 8; and c = 30. c == a + b is false. • Programs 2 and 3 (code is different, output is same). Please enter student’s semester and final exam grades: 95 76 Student’s numeric and letter grades are 91.2 and A....
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern