Professional Documents
Culture Documents
Faculty of Mechanical Engineering, Universiti Teknologi Mara (Uitm)
Faculty of Mechanical Engineering, Universiti Teknologi Mara (Uitm)
LECTURER/
: NORHARZIANA BINTI YAHAYA RASHDI
INSTRUCTOR NAME
GROUP : EMD2M5A2
ASSIGNMENT 2
TITLE :
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;
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;
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;
return 0;
}
Sample output