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

// TESTING: // // Test Case 1: // ------------ // DESCRIPTION: // Tests that the

ID: 3563185 • Letter: #

Question

// TESTING:
//
// Test Case 1:
// ------------
// DESCRIPTION:
// Tests that the assignment and course percentages are calculated correctly.
//
// TEST CASE INPUT DATA:
// a1 = 12, a2 = 15, a3 = 9, e1 = 71, e2 = 82, e3 = 100
//
// EXPECTED OUTPUT GIVEN THE INPUT:
// Assignment percentage should be 80.00%.
// Course percentage should be 85.60%.
//
// OBSERVED OUTPUT:
// <Document the observed output, i.e., what assignment and course percentages did your program
// display?>
//
// TEST CASE RESULT:
// <If the output from your program matches the expected output, then write PASSED here to indicate
// that your program passed the test case. If the output from your program does not match the
// expected output then find the bug(s) and correct them. If you cannot find the bug(s) and
// correct them, then write FAILED here to indicate that your program did not pass the test case.>
//
// Test Case 2:
// ------------
// DESCRIPTION:
// Tests that the output is formatted correctly.
//
// TEST CASE INPUT DATA:
// a1 = 6, a2 = 4, a3 = 8, e1 = 35, e2 = 55, e3 = 71
//
// EXPECTED OUTPUT GIVEN THE INPUT:
// ------------------------------
// Assignment 1: 6 / 15
// Assignment 2: 4 / 15
// Assignment 3: 8 / 15
// Exam 1: 35 / 100
// Exam 2: 55 / 100
// Exam 3: 71 / 100
// Assignment Percentage: 40.00%
// Course Percentage: 52.85%
// ------------------------------
//
// OBSERVED OUTPUT:
// <Document the observed output, i.e., was everything displayed correctly?>
//
// TEST CASE RESULT:
// <If the output from your program matches the expected output, then write PASSED here to indicate
// that your program passed the test case. If the output from your program does not match the
// expected output then find the bug(s) and correct them. If you cannot find the bug(s) and
// correct them, then write FAILED here to indicate that your program did not pass the test case.>
//**************************************************************************************************
#include ??? // For setprecision(), setw()
#include ??? // For cin, cout, endl, fixed, right

using namespace std;

// Define the required constants
???

// Write the header for the main() function
???

// Define the required int variables
???

// Define the required double variables
???

// Display the
???

// Display the prompt for assignment 2 and read integer from keyboard into a2
???

// Display the prompt for assignment 3 and read integer from keyboard into a3
???

// Calculate the assignment percentage and assign result to variable 'ap'. Do not forget to
// typecast ASSIGN_PTS to double.
???

// Display the prompt for exam 1 and read integer from keyboard into e1
???

// Display the prompt for exam 2 and read integer from keyboard into e2
???

// Display the prompt for exam 3 and read integer from keyboard into e3
???

// Calculate the course percentage and assign result to variable 'cp'.
???

// Configure cout to output real numbers in fixed notation with two digits after the decimal
// point. Configure cout to display values right-justified.
???

// Write the statements to generate the output.
???

return 0;
}

Students in CS01 Computer Programming complete three programming assignments, each worth 15 points, and take three exams each worth 100 points. A student's letter grade at the end of the semester is based on his or her course percentage (cp). The course percentage is defined by the formula. where ap is the student's assignment percentage, defined as, ap = a1 + a2 + a3/45 times 100 Where a1-a3 are the student's assignment scores. This formula assigns weights of 25% to the assignments, 20% to the first two exams, and 35% to the third exam. The lab exercise is write a complete C++ program which performs the following tasks: It shall ask the user to enter the four assignment scores. It shall ask the user to enter the three exam scores. It shall calculate the assignment percentage. It shall calculate the course percentage. It shall display the results formatted in a table as shown below in the Sample Output section.

Explanation / Answer

#include <iostream>
#include <iomanip>

#define APP 0.25

#define E1P 0.20

#define E2P 0.20

#define E3P 0.35

using namespace std;
int main()
{
int a1,a2,a3,a4,e1,e2,e3;
double ap,cp;
cout<<"Enter the three assignments marks:";
cin>>a1>>a2>>a3;
cout<<'/n'<<"Enter the three exams marks:";
cin>>e1>>e2>>e3;

ap = ((a1+a2+a3)*100)/45;
cp = APP * ap + (E1P*e1 + E2P*e2 + E3P*e3);

cout<<' '<<"Assignment 1:"<<a1<<"/15";
cout<<' '<<"Assignment 2:"<<a2<<"/15";
cout<<' '<<"Assignment 3:"<<a3<<"/15";

cout<<' '<<"Exam 1:"<<e1<<"/100";
cout<<' '<<"Exam 2:"<<e2<<"/100";
cout<<' '<<"Exam 3:"<<e3<<"/100";

cout<<' '<<"Assignment percentage:"<<fixed<<setprecision(2)<<ap<<"%";
cout<<' '<<"Course percentage:"<<fixed<<setprecision(2)<<cp<<"%";
return 0;
}

The above program satisfies both the test cases.