0% found this document useful (0 votes)
30 views

Spring 2023 - CS101 - 2 - SOL

The document provides instructions for Assignment No. 02 for the course CS101 Introduction to Computing. It details the rules for marking, topics covered, objectives of the assignment, and notes regarding submission. The assignment asks students to develop a C++ program to calculate total and average marks for a student and determine their final grade based on score ranges. Students are to input their own VU ID and marks for four subjects, and the program should output these along with the calculated total, average, and assigned grade.

Uploaded by

HAADII BHUTTA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Spring 2023 - CS101 - 2 - SOL

The document provides instructions for Assignment No. 02 for the course CS101 Introduction to Computing. It details the rules for marking, topics covered, objectives of the assignment, and notes regarding submission. The assignment asks students to develop a C++ program to calculate total and average marks for a student and determine their final grade based on score ranges. Students are to input their own VU ID and marks for four subjects, and the program should output these along with the calculated total, average, and assigned grade.

Uploaded by

HAADII BHUTTA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Total marks = 20

Introduction To Computing
(CS101) Deadline
Assignment No. 02 th
11 of July, 2023
Spring 2023
Please carefully read the following instructions before attempting the assignment.

RULES FOR MARKING


It should be clear that your assignment would not get any credit if:
 The assignment is submitted after the due date.
 The submitted assignment does not open or the file is corrupt.
 Strict action will be taken if the submitted solution is copied from any other student
or the internet.

You should consult the recommended books to clarify your concepts if video lessons/handouts
are not sufficient.

You are supposed to submit your assignment in Doc or Docx format.


Any other formats like scan images, PDF, ZIP, RAR, PPT, BMP, TXT, etc. will not be accepted.

Topic Covered: Week 09 (Lesson no. 109 to 125)

Objectives:

 To learn the use of C++ Variables, Mathematical Operators, Logical Operators.


 To learn the use of “if/if-else” structure in C++.
 To have hands on practice of computer programming.

NOTE

No assignment will be accepted after the due date via email in any case (whether it is the case
of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignments
in the last hour of the deadline. It is recommended to upload the solution file at least two days
before its closing date.

If you people find any mistake or confusion in the assignment (Question statement), please
consult with your instructor before the deadline. After the deadline, no queries will be
entertained in this regard.

For any query, feel free to email me at:


[email protected]
Questions No. 01 Marks (15 for code + 5 for output screenshot)

Deciding the Final Grads of various students manually is a tedious and challenging task. Your job is to
develop a C++ program that should be capable of calculating the Total and Average Marks of a student.
Based on the above calculations the program should award the correct Final Grad to a student. Following
is the sample screenshot of the Input and Output of a student.

Working Mechanism:

The program should allow the users to enter their OWN VU-ID and any random marks for four subjects
CS, Math, Pak Study, and MGT. Then, the Total marks and Average Marks are calculated using
mathematical operators on variables for each subject. The program should use Control Structure “if or if-
else” and “Logical Operator(s)” to decide the final grad of a student based on the Average Marks. Also,
the following score limits should be implemented in your program to grant Correct grad to a student as
per the following upper and lower score bounds/limits. For example, if a student got Average Marks 86
then Grad “A- “should be awarded as present in the sample screenshot.

Lower and upper bounds for grads:

91 to100 => Grad: A+


81 to 91 => Grad: A-
71 to 81 => Grad: B+
61 to 71 => Grad: B-
51 to 61 => Grad: C
41 to 51 => Grad: D
35 to 41 => Grad: E
34 to 0 => Fail
How/What to submit as assignment solution?

Write your code in a compiler application and run it to generate the output. After that copy your
code and paste it into a Microsoft Word document (your solution file). Also, take a screenshot of
your program’s output and paste it into the solution file along with the code.

You can use any online or offline C++ compiler for writing your code for the assignment solution. Few
links for the online compilers are given below:
https://www.onlinegdb.com/online_c++_compiler
https://www.w3schools.com/cpp/cpp_compiler.asp

Hint:
“cin>>” command is used in C++ programs to take some input from the user during the program
execution.

Note:
 Your solution file must be a Microsoft Word document (in .doc or .docx file extension).
 Solution file must contain both code and the output screenshot of your code. No marks will be
awarded in case any of these (code/output) is missing.
 It is mandatory to use your own Student ID in the program (No marks will be awarded if the
student’s personal information is missing/copied or the VUID of some other student is used).
 Questions No. 01 Marks (20)

Solution:
C++ code: 15 Marks
/*****************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*****************************************************************************/

#include <iostream>
using namespace std;

int main()
{
int CS_Marks, MATH_Marks, PK_Study_Marks,MGT_Marks, Total_Marks;
float Average_Score;

char VU_ID[11];
cout<<"Enter your VU-ID:"<<endl;
cin>>VU_ID;
cout<<"Enter Marks of CS:"<<endl;
cin>>CS_Marks;
cout<<"Enter Marks of Math:"<<endl;
cin>>MATH_Marks;
cout<<"Enter Marks of Pak Study:"<<endl;
cin>>PK_Study_Marks;
cout<<"Enter Marks of MGT:"<<endl;
cin>>MGT_Marks;
Total_Marks= CS_Marks+MATH_Marks+PK_Study_Marks+MGT_Marks;
Average_Score = Total_Marks/4;
cout<<"VU ID:"<<VU_ID<<endl;
cout<<"Total Marks:"<<Total_Marks<<endl;
cout<<"Average Marks:"<<Average_Score<<endl;
if(Average_Score>=91 && Average_Score<=100)
cout<<"Grad:A+";
else if(Average_Score>=81 && Average_Score<91)
cout<<"Grad:A-";
else if(Average_Score>=71 && Average_Score<81)
cout<<"Grad:B+";
else if(Average_Score>=61 && Average_Score<71)
cout<<"Grad:B-";
else if(Average_Score>=51 && Average_Score<61)
cout<<"Grad:C";
else if(Average_Score>=41 && Average_Score<51)
cout<<"Grad:D";
else if(Average_Score>=33 && Average_Score<41)
cout<<"Grad:E"<<endl;
else
cout<<"Fail"<<endl<<"Work hard in next semester to get good Grad";
return 0;
}
Output Screenshot: 05 Marks

You might also like