Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

FACULTY OF MECHANICAL ENGINEERING,

UNIVERSITI TEKNOLOGI MARA (UITM)

BACHELOR OF ENGINEERING (HONS) MECHANICAL


PROGRAM : (EM220)

COURSE : COMPUTER PROGGRAMING AND APPLICATION

COURSE CODE : CSC430

LECTURER/
: NORHARZIANA BINTI YAHAYA RASHDI
INSTRUCTOR NAME

GROUP : EMD2M5A2

ASSIGNMENT 2
TITLE :

ARIEF HAKEEM BIN ZULHAIME


STUDENT’S NAME :

STUDENT’S ID : 2020878498
TASK 1

Coding
/*
Name: Arief Hakeem Bin Zulhaime
Sid#: 2020878498
Course: CSC430
Title: Assignment 2 Task 2
Group: EMD2M5A2
Due Date: 28/5/2021
Program Description: Computer Programming And Applications
*/

#include <iostream>
using namespace std;

int main()
{
char program;
char diploma = 'D', bachelor = 'B', master = 'M';
float cgpa;

cout << "Enter Your Program : " << endl;


cin >> program;
cout << "Enter Your CGPA : " << endl;
cin >> cgpa;
if (program=='D')
{
if (cgpa>=0.00&&cgpa<=4.00)
{

if (cgpa<3.00)
{
cout << "You get RM5,000 per year " << endl;
}

else if (cgpa>=3.00)
{
cout << "You get RM 7,000 per year " << endl;
}

else
{
cout << "Invalid CGPA" << endl;
}
}

else if (program=='B')
{
if (cgpa>=0.00&&cgpa<=4.00)
{
if (cgpa<3.30)
{
cout << "You get RM6,000 per year " << endl;
}

else if (cgpa>=3.30)
{
cout << "You get RM 10,000 per year " << endl;
}

else
{
cout << "Invalid CGPA" << endl;
}
}

else if (program=='M')
{
if (cgpa>=0.00&&cgpa<=4.00)
{

if (cgpa<3.50)
{
cout << "You get RM9,000 per year " << endl;
}

else if (cgpa>=3.50)
{
cout << "You get RM 12,000 per year " << endl;
}

else
{
cout << "Invalid CGPA" << endl;
}
}

else
{
cout << "Invalid Program" << endl;
}

return 0;
}
Sample output
Task 2

Coding

/*
Name: Arief Hakeem Bin Zulhaime
Sid#: 2020878498
Course: CSC430
Title: Assignment 2 Task 2
Group: EMD2M5A2
Due Date: 28/5/2021
Program Description: Computer Programming And Applications
*/

#include <iostream>
using namespace std;

int main()
{
int studentcount, students, score, min, max;
int studentaboveequal_50, studentbelow_50;
float totalscores, average;

cout<<"How many students have taken the exam"<<endl;


cin>> students;

studentcount=0;
studentaboveequal_50=0;
studentbelow_50=0;
min=100;
max=0;

while(students>studentcount)
{
cout<<"Please enter scores: ";
cin>> score;

if(score>=0&&score<=100)
{
if (score >max)
max = score;
if (score < min )
min = score;

{
if (score >= 50)
{
studentaboveequal_50=studentaboveequal_50+1;
}

else
{
studentbelow_50=studentbelow_50+1;
}

studentcount=studentcount+1;
totalscores=totalscores+score;

average=totalscores/students;

cout<<"The class average was :"<<average<<endl;


cout<<"The highscore was :"<<max<<endl;
cout<<"The low score was : "<<min<<endl;
cout<<"The number of students earned scores equal and above 50
marks was :"<<studentaboveequal_50<<endl;
cout<<"The number of students earned scores below 50 marks was :
"<<studentbelow_50<<endl;

return 0;
}
Sample output

You might also like