0% found this document useful (0 votes)
4 views3 pages

Programming Assignment 3

Uploaded by

cliffordawuah585
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Programming Assignment 3

Uploaded by

cliffordawuah585
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

NAME: Clifford Awuah Sarkodie

ID Number: 10642322
SESSION: Regular
PROGRAM: DIPIT
DATE: 24th February 2026
COURSE: WIT211 – Principles of Programming

ASSIGNMENT
Question: Write a complete program to do these for each student: Input each student’s middle
initial as name, Input course code as one character, Input three continuous assessment marks
(over 50, 30, 20), Compute total continuous assessment mark (over 30), Check if this total is less
than 10, give student warning, Input final examination mark (over 100), Compute final
examination mark (over 70), Check if this total is less than 25, give student warning, Find final
semester mark as sum of continuous assessment and final examination mark (over 100),
Categorize the final mark into grades (70+ A, 60+ B, 50+ C, 40+ D, or <40 F), and Output all data
(student’s full name, full course code, all marks, etc.)

COMPLETE C++ PROGRAM


/*This program prompts the user for his middle initial, course code, continuous assessment
marks, and final exam mark. It then calculates the total CA marks and expressed over 30,
calculates final exam score over 70, sums them, and assigns a grade to it.*/

#include <iostream>
using namespace std;

int main()
{ //Declaring variables for the program
char middleInitial;
char courseCode;
float mark1, mark2, mark3;
float totalCA, convertedCA;
float examMark, convertedExam;
float finalMark;
char grade;

//Inputting the student’s middle initial as name


cout << “Enter student’s middle initial: “;
cin >> middleInitial;

//Inputting the course code as one character


cout << “Enter course code (single character): “;
cin >> courseCode;

//Inputting the three CA marks over 50, 30, and 20.


cout << “Enter first CA mark (over 50): “;
cin >> mark1;

cout << “Enter second CA mark (over 30): “;


cin >> mark2;

cout << “Enter third CA mark (over 20): “;


cin >> mark3;

totalCA = mark1 + mark2 + mark3;

//Computing total CA mark over 30


convertedCA = (totalCA / 100) * 30;

//Giving warning if total CA mark is less than 10


if (convertedCA < 10)
{
cout << “WARNING: Continuous Assessment is below 10!”;
}

//Inputting final examination mark over 100


cout << “Enter final exam mark (over 100): “;
cin >> examMark;

//Computing final exam mark over 70


convertedExam = (examMark / 100) * 70

//Giving warning if total final exam mark is less than 25.


if (convertedExam < 25)
{
cout << “WARNING: Final Exam is below 25!”;
}

//Finding the final semester mark as sum of CA and final exam mark.
finalMark = convertedCA + convertedExam;

//Categorizing the final mark into grades.


if (finalMark >= 70)
grade = ‘A’;
else if (finalMark >= 60)
grade = ‘B’;
else if (finalMark >= 50)
grade = ‘C’;
else if (finalMark >= 40)
grade = ‘D’;
else
grade = ‘F’;

//Outputting all data on each student and their grade.


cout << “\n----- STUDENT RESULT -----\n”;
cout << “Student Middle Initial: “ << middleInitial;
cout << “Course Code: “ << courseCode;
cout << “CA Marks: “ << mark1 << “, “ << mark2 << “, “ << mark3;
cout << “Total CA (over 30): “ << convertedCA;
cout << “Exam Mark (over 70): “ << convertedExam;
cout << “Final Semester Mark (over 100): “ << finalMark;
cout << “Grade: “ << grade;

cout << “Program Ended.”;

return 0;
}

You might also like