# data[].attributes.body
All Files needed for lab test 2

# data[].attributes.body
The code (filename): p183e3.cpp
/*
p183
exercise 2:
Write a program that reads from
a file all the details of students
in a class of size 20.
The details include Student ID,
Name, and GPA.
Use an array of structure
to store all the data
and then display them on the screen.

exercise 3:
Enhance the program written for the previous question
by adding an array into the structure in order to store
five quizzes marks for each student,
and display all the students' data on the screen.
Therefore, it will become an array of structures,
which in turn contains an array.
*/

#include <iostream>
using namespace std;
#include <cstdlib>  //exit()
#include <fstream>
#include <cstring>  //strcpy()
#include <iomanip> //fixed(),setprecision()

// global variable:
struct student
{
char student_id[11];
char name[100];
double gpa;
double quizzes[5];
}; //end struct student

const int number_of_quizzes = 5;

void initStudent(student &s);
double getGPA();
double getQuiz();

void showStudent (student s);
void showStudents (student s[], int number_of_students);
void initStudentsFromFile(student s[], int number_of_students);

int searchStudent(student s[]);

int main()
{
student students[20];

/*
initStudent(students[0]);
showStudent (students[0]);
cout << endl;
showStudents (students, 1);
*/

initStudentsFromFile(students, 4);
showStudents (students, 4);

return 0;
} //end main

//the bodies of the functions:

int searchStudent(student s[])
{
char metric_no[11] ;

cout << "\n\t Enter your metric no: " ;
cin >> metric_no;

int indexfound = -1;
for(int index = 0 ;
index < number_of_students;
index++ )
{
if( strcmp( metric_no, s[index].student_id) == 0)
{
indexfound = index;
break;
}
}
return indexfound;
} //end searchStudent(student s[])

void initStudentsFromFile(student s[], int number_of_students)
{
char fsid[11];
char fname[100];
double fgpa;
string headerLine;
double fquiz;

ifstream inputFile;
inputFile.open("studentsv2.txt", ios::in);
//to check weather you have the access to input file
if (!inputFile)
{
cout << "File could not be opened " << endl;
exit(1);
}

//read File header
getline(inputFile,headerLine);
//cout << headerLine << endl;

//to read the data from file and display it to screen.
for(int index = 0; index < number_of_students; index++)
{
inputFile >> fsid;
cout << fsid << "  ";

//inputFile >> fname; //can not be used to get a full name.
inputFile.getline(fname, 100, '#');
cout << fname << "  ";

inputFile >> fgpa;
cout << fgpa << "  ";

//cout << endl;

//to set the value of each element in the array of student
//using the input from file
strcpy(s[index].student_id, fsid);
strcpy(s[index].name, fname);
s[index].gpa = fgpa;

//to get quizzes marks: There are five quizzes
for(int qindex = 0; qindex < number_of_quizzes; qindex++)
{
inputFile >> fquiz;
cout << fquiz << " ";
s[index].quizzes[qindex] = fquiz;
}
//to test the result of 3 lines above
//showStudent (s[index]); //input parameter data type is student,
//one element of array of student.
//cout << endl;
cout << endl;

}
inputFile.close();
//showStudents(s, number_of_students);

}  //end initStudentsFromFile()

//display all students. Input parameter is the array of student.
void showStudents (student s[], int number_of_students)
{
for(int index = 0; index < number_of_students; index++)
{
showStudent (s[index]);
}
} //end showStudents()

//input parameter data type is student.
void showStudent (student s)
{
cout << "\n\t Metric Number: "
<< s.student_id << endl;
cout << "\n\t Name: "
<< s.name << endl;
cout << "\n\t GPA: "
<< fixed << setprecision(2) <<s.gpa << endl;
for(int index = 0; index < number_of_quizzes; index++)
{
cout << "\n\t Quiz-" << index+1 << "marks: "
<< s.quizzes[index] << endl;
}
} //end showStudent

//initialize one student with input key in from keyboard
void initStudent(student &s)
{
cout << "\n\t Enter your Metric Number: ";
cin >> s.student_id;

//clear the keyboard buffer:
cin.ignore(100, '\n');

cout << "\n\t Enter your Name: ";
cin.getline(s.name, 100, '\n') ;
cout << "\n\t Enter your GPA: ";
//cin >> s.gpa;
s.gpa = getGPA();

for (int index = 0; index < number_of_quizzes; index++)
{
cout << "\n\t Enter your quiz-" << index+1 << " mark : ";
s.quizzes[index] = getQuiz();
}
} //end initStudent()

double getGPA()
{
double mark;
while(!(cin >> mark) || mark < 0.0 || mark > 4.0 )
{
cin.clear();
cin.ignore(100, '\n');
cout << "\n\t Enter positive number [0 .. 4]: ";
}
return mark;
} //end getGPA()

double getQuiz()
{
double mark;
while(!(cin >> mark) || mark < 0.0 || mark > 100.0 )
{
cin.clear();
cin.ignore(100, '\n');
cout << "\n\t Enter positive number [0 .. 100]: ";
}
return mark;
} //end getQuiz()

//end of program

//File to be read: studentsv2.txt
Student ID, Name, GPA, quiz1, quiz2, quiz3, quiz4, and quiz5
B10 Lau Siong Hoe# 3.99 10 9 8 7 6
B20 Chandana Prasad# 3.75 10 9 8 7 6
B30 Ro Wei Na# 3.8 10 9 8 7 6
B40 Khine Khine Nyut# 3.6 10 9 8 7 6

# data[].attributes.body
page 67 exercise 3

# data[].attributes.body
page 55 exercise 3

# data[].attributes.headline
nurul syakirah binti mohamd zaid (B011610118) page 153 bekgs1

# data[].attributes.subject
nurul syakirah binti mohamd zaid (B011610118) page 153 bekgs1

# data[].attributes.body
Students' answers:
NO, Metric No and 20 answers for quiz1 questions 1 to 20, Mark(5%).
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0       Mark
1  B011610197 A B D C C C C C A D C D A A C C A C B C 3.25
2  B011610259 C B D C C C C C A D C D D D C C C D B A 3.25
3  B011210155 C B D C C C C C A A C B D D C B C B B B 3.25
4  B011610062 C B D C C C C C A D C D D D C C B D B A 3.25
5  B011610243 C B D C C C C C A D C D D D C C C D B A 3.25
6  B011410027 C B D C C C C C A A D D B A C B C B B B 3.5
7  B011410024 C B D C C C C C A A D D B A C B C B B B 3.5
8  B011520008 C B D C C C C C A A C D D D C B C B B B 3.5
9  B011520025 C B D C C C C C A A D D D B C B C B B B 3.25
10 B011610242 C B D C C C C C A D D D D D C C C D B A 3.25
11 B011610261 C B D C C C C C A D C D D D C C D D B A 3.25
12 B011610254 C B D C C C C C A D D D D D C C B D B A 3.25
13 B011610268 C B D C C C C C A D C D C D C B D D B C 3.25
14 B011410041 C B D C C C C C A D D D B A C B C B B B 3.5
15 B011410025 C B D C C C C C A A D D B A C A C B B B 3.25
16 B011410291 C B D C C C C C A A D D B A C A C B B B 3.25
17 B011410023 C B D C C C C C A A D D B A C B C B B B 3.5
18 B011410022 C B D C C C C C A A D D B A C B C B B B 3.5
19 B011610072 A B D C C C C D B B C C A A C B C B B C 3
20 B011610090 A B D C C C C D B B C C A A C B C B B C 3
21 B011610103 A B D C C C C D A D C C B D C B C C B C 3.5
22 B011510022 B B D C C C C D C D B B B A C D C C B C 2.25
23 B011610119 A B D C C C C C A D D D B D C B C C B C 3.75
24 B011510178 B B D C C C C C A A C D D D C B C B B C 3.5
25 B011510141 B B D C C C C C A A C D B D C B C B B C 3.75
26 B011610089 A B B C C C C C A D D D B A C B C B B C 3.5
27 B011610126 B B D C C C C C C A B D A D C B C C A A 3
28 B011410078 B B D C C C C C A A D D D B C B C B B B 3.25
29 B011510228 B B D C C C C C A A C D D B C B C B B C 3.25
30 B011610147 A B D C C C C D A D C C B D C B C C B C 3.5
31 B011610118 B B D C C C C C A A C D D A C D D B A A 3
32 B011610034 B B D C C C C C A C C A A A C C B B A A 3
33 B011610079 B B D C C C C C A C C A D A C D B B A A 3
34 B011610138 B B D C C C C C A A C D D D C D C B B D 3.25
35 B011610108 B B D C C C C D A D C D D D C D C B B D 3
36 B011610048 B B D C C C C C B C C C A A C B A D B C 3.25
37 B011610148 A C B B C C C C A C C A A A C C C B A D 2.25
38 B011610166 A B D C C C C C A D D D B A C B C B B C 3.75
39 B011610154 C B D C C C B D A A C D C A C B C D B D 2.5
40 B011610267 C B D C C C C C A D C C D A C C C A A A 2.75
41 B011610129 B B D C C C C C A A C C C A C A D C A B 2.5
42 B011610136 A B D C C C C C A D C D A D C B C C B C 3.5
43 B011610177 A B D C C C C C A D D D B D C B C C B C 3.75
44 B011610061 A B D C C C C C A D D D B A C B C C B C 3.5
45 B011410205 C B D C C C C C A A D D D B C B C B B B 3.25
46 B011520012 C B D C C C C C A A D D D D C B C B B B 3.5
47 B011520020 C B D C C C C C A A D D D B C B C B B B 3.25
48 B011410087 B B D C C C C C A A D D B A C B C B B B 3.5
49 B011510172 B B D C C C C C A A C D D B C B C B B C 3.25
50 B011510267 B B D C C C C C A A C D D D C B C B B C 3.5
51 B011610113 A B D C C C C C A D D D B D C B C B B B 4
52 B011610018 A B D C C C C C A A D D D B C C C B B C 3.25
53 B011610006 A B D C C C C C B A D D D D C C A B B B 3.5
54 B011610082 B B D C C C C C A C C D D A C D C C B C 3
55 B011610239 A B D C C C C C A D C D B D C B C C B C 3.75
56 B011610096 B B B C C C C D A A C C A A C B C B B B 2.75
57 B011610050 A B D C C C C C A D C D A A C C D D A D 2.75
58 B011610071 B B B C C C C C A A C D D A C C C C B A 2.75
59 B011610164 B B B C C C C C A A C D D A C C C C B A 2.75
60 B011610109 B B D C C C C C A D C B D A A C B B A D 2.25
61 B011610102 B B B C C C C C A A C D D A C C C C B A 2.75
62 B011610097 B B D C C C D C A D C B D D C C A B A A 3
63 B011610178 C B D C C C C C A B C D D D C C D C B A 3.25
64 B011610016 B B D C C C C C A C C A D A C C B B A A 3
65 B011410312 C B D C C C C D A C C D C D C B A B A A 3.75
66 B011610156 B B D D C C C D C A C D A A C D C B A A 2.25

# data[].attributes.body
NORIZATI BINTI MOHD NAWI (B011610109

# data[].attributes.headline
Lab Assessment Week 11  14-18 Nov 2016, submit on Monday, 21 Nov 2016.

# data[].attributes.subject
Lab Assessment Week 11  14-18 Nov 2016, submit on Monday, 21 Nov 2016.

# data[].attributes.body
Answer Question 2 on page 153.
Write the program on A4 paper.

/*
Question 2:

Alter the program you've developed for Exercise 1
that prompts the user to enter other students' id
and their answers for the quiz.
Then print the students' id and answers by appending
to the studAnswers.txt file.
For each question, calculate the number of students
who answer the question correctly and
write the calculated value to the output file
named questSummary.txt.

Input File:
studAnswers.txt

Output File:
studAnswers.txt
questSummary.txt

*/

# data[].attributes.body
file name: p153e1.cpp

# data[].attributes.attachment_link.readable_text
/* Page 153
Question 1:
Create a file named studAnwers.txt as shown below.
This file contains answers of 10 students for 10 objective
question asked in a quiz.
Each line of the file contains a student's id 
followed by her/his answers for question 1 to 10.

S01 A C D C A B B C C D
S02 A C D A A B A D C D
S03 A C C A B B B C C D
S04 A B D A B C B D C D
S05 B C C A A B B D C B
S06 A B D B A B C D C C
S07 C B D B A C B D B D
S08 A D D C A A B C C D
S09 B C C A B B B D C D
S10 B C D A A B B D C B 

Write a program that opens the studAnswers.txt 
file for input. The program calculates the number
of right answers of each student 
in each line of the file) and the marks scored by
the student for the quiz. Then, the results are written
to the output file named studResult.txt 
(Assume that the answers for question 1 to 10 are
A, C, D, A, A, B, B, D, C, D in sequence and
the total marks for the quiz is 5%).


Input File:
studAnswers.txt

Output File:
studResult.txt

*/

#include <fstream>
#include <iostream>
using namespace std;
#include <cstdlib>  //exit()

double assessTheAnswer(char ref, char answer);


int main()
{
	//variables declaration:
	
	string headerLine;
	
	char theanswers[11] = "ACDAABBDCD";
	char fsid[10];
	char fanswer;
	
	
	
	//cout << theanswers << endl;
	//for (int index = 0; index < 10; index++)
		//cout << theanswers[index] << endl;
	
	
	ifstream inputFile("studAnswers.txt");
	
	//to check weather you have the access to input file
	if (!inputFile)
	{
		cout << "File could not be opened " << endl;
		exit(1);
	}
	
	ofstream outputFile("studResult.txt");
	
	//to check weather you have the access to output file
	if (!outputFile)
	{
		cout << "File could not be opened " << endl;
		exit(1);
	}
	//write the header for ouput file
	outputFile << "Student's ID, the number of right answers of each student \n";
	outputFile << "and the marks scored by the student for the quiz.\n";
	
	
	//read File header
	getline(inputFile,headerLine);
	cout << headerLine << endl;
	
	getline(inputFile,headerLine);
	cout << headerLine << endl;
	
	//Read the answers for each student for TEN students
	for(int ocounter = 0; ocounter < 10 ; ocounter++)
	{
		double thescore = 0.0;
		//input from file:
		inputFile >> fsid;
		cout << fsid << "  ";
		
		//read each student answers for question 1 to 10.
		for(int icounter = 0; icounter < 10 ; icounter++)
		{
			//input from file:
			inputFile >> fanswer;
			cout << fanswer << "  ";
			
			//process:
			thescore = thescore + 
						assessTheAnswer(theanswers[icounter], fanswer);
		}
		
		cout << thescore;
		
		//output to the file:
		outputFile << fsid << "  " << 2*thescore 
					<< "  "<< thescore << endl;
		cout << endl;
	}
	return 0;
} //end main

double assessTheAnswer(char ref, char answer)
{
	double mark = 0.0;
	if (answer == ref) 
		mark = 0.5;
	
	return mark;
}












# data[].attributes.attachment_link.readable_text
/*NURUL SYAKIRAH BT MOHAMAD ZAID PAGE 136 B011610118 */
#include <iostream>
using namespace std;
void readData (int studMarks[20][5]);
void calTotMarks (int studMarks[20][5],int totMarks[]);
void display (int studMarks[20][5] ,int totMarks[]);
int main()
{
	int studMarks[20][5],totMarks[20];
	readData (studMarks);
	calTotMarks (studMarks,totMarks);
	display (studMarks,totMarks);
	return 0;
}

void readData(int studMarks[20][5])
{
	for(int i=0,i<20,i++)
	{
		cout<<"Student Number"<<i+1<<".\n";
		for(int j=0,j<5,j++)
		{
			cout<<"Marks for subject number"<<j+1":";
			cin>>studMarks[i][j];
		}
		cout<<endl;
	}
}
void calTotMarks(int studMarks[20][5],int totMarks[])
{
	for(int i=0,i<20,i++)
	{
		cout<<"Student Number"<<i+1<<":.\n";

	}
	cout<<"\t Total of marks:"<<totMarks[i]<< endl<< endl;
}



# data[].attributes.attachment_link.readable_text
/*NURUL SYAKIRAH BT MOHAMAD ZAID PAGE 67 B011610118 */
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
float annual_interest_rate,starting_balance,number_of_month,amount_withdrawal,amount_deposited,monthly_interest,(float sum,float total);

	sum=0;
	total=0;
	count=1;

	do
	{
		cout<<"\nEnter the annual_interest_rate: ";
		cin>>annual_interest_rate;
		if(interest_rate<0)
		cout<<"it should be a positive number.\n\n";
	}while(anuual_interest_rate>0);

				do
				{
					cout<<"\nEnter the starting balance ";
					cin>>starting_balance;
					if(starting_balance<0)
					cout<<"it should be positive number";
				}while(starting_balance<0);


				do
				{
					cout<<"\nHow many number of month has passed since the account has established ";
					cin>>monthly_deposited;
				}if(monthly_deposited<0)
				cout<<"

			}



		cout<<"\n The ending balance= "<<ending_balance<<endl;

		cout<<"\nThe_total_amount_of_deposit= "<<amount_deposited<<endl;

		cout<<"\nthe_total_amount_of_withdrawals "<<amount_withdrawal<<endl;

		cout<<"\n The total interest earned."<<interest_earned<<"%";


}

float percentage(float sum,float total)
{
	return (sum/total*100);
}

# data[].attributes.attachment_link.readable_text
/*nurul syakirah bt mohamad zaid b011610118 page 136 */
#include <iostream>
using namespace std;

int main()
{
	double image1A, image1B, image2A, image2B, image3A, image3B;
	double difference1, difference2, difference3;
	double Facedifference1, Facedifference2, Facedifference3;

	cout << "Enter valus in cm.\n";
	cout << "\nEnter eye distance and nose to chin distance for image 1 : \n";
		cout << " Eye Distance: ";
		cin >> image1A ;
		cout << " Nose To Chin Distance: ";
		cin >> image1B;

	cout << "\nEnter eye distance and nose to chin distance for image 2 : \n";
		cout << " Eye Distance: ";
		cin >> image2A ;
		cout << " Nose To Chin Distance: ";
		cin >> image2B ;

	cout << "\nEnter eye distance and nose to chin distance for image 3 : \n";
		cout << " Eye Distance: ";
		cin >> image3A ;
		cout << " Nose To Chin Distance: ";
		cin >> image3B;

	difference1 = image1A - image1B;
	difference2 = image2A - image2B;
	difference3 = image3A - image3B;

	Facedifference1 = difference1 - difference2;
	Facedifference2 = difference1 - difference3;
	Facedifference3 = difference2 - difference3;

	if (Facedifference1 < 0)
	{
		Facedifference1 = Facedifference1*-1;
	}

	if (Facedifference2 < 0)
	{
		Facedifference2 = Facedifference2*-1;
	}

	if (Facedifference3 < 0)
	{
		Facedifference3 = Facedifference3*-1;
	}


	if (Facedifference1 < Facedifference2 && Facedifference1 < Facedifference3)
	{
		cout << "Best matches is between image 1 and image 2 \n\n";
	}
	else if (Facedifference2 < Facedifference1 && Facedifference2 < Facedifference3)
	{
		cout << "Best matches is between image 1 and image 3 \n\n";
	}
	else if (Facedifference3 < Facedifference1 && Facedifference3 < Facedifference2)
	{
		cout << "Best matches is between image 2 and image 3\n\n";

	}else
	{
		cout << "\nAll imagas have the same matches !!";
	}
	return 0;
}

# data[].attributes.headline
NURUL IZIAN SYAMIMI BINTI SUHAIMI (PAGE136)

# data[].attributes.subject
NURUL IZIAN SYAMIMI BINTI SUHAIMI (PAGE136)

# data[].attributes.body
B01161001

# data[].attributes.body
MUHAMAD HAFIZUL BIN SANI
B011410087
4 BEKP 2*

# data[].attributes.body
MUHAMAD HAFIZUL BIN SANI
B011410087
BEKP 2*

# data[].attributes.body
MUHAMAD HAFIZUL BIN SANI
B011410087
4 BEKP 2

# data[].attributes.body
//page 136 - exercise 1
/*
File name: p136e1.cpp
Body Mass Index (BMI) is a measure of health on weight.
It can be calculated by taking your weight in kilograms and
dividing by the square of your height in metres.
Write a program that lets a teacher to calculate the BMI of 20 students.
The program should use three one dimensional ARRAYS named studWeight
that holds the weight (in kilograms), studHeight that holds the height (in meters)
and studBMI that holds the calculated BMI for each student.
The program contains the following functions:
a) readData: This function receives the studWeight and studHeight ARRAYS
from the main function. It reads the weight and height for all the students
and stored them in the studWeight and studHeight ARRAYS, respectively.

b) calBMI: This function receives one element of the studWeight and
studHeight ARRAYS. It calculates the BMI of each student
based on her/his weight and height, and then store the BMI in the studBMI ARRAY.

c) display: This function displays the BMI of the students and its interpretation.

BMI for people 16 years or older is interpreted as follows:
BMI Interpretation
=============================
below 16 seriously underweight
16 - 18 underweight
18 - 24 normal weight
24 - 29 overweight
29 - 35 seriously overweight
above 35 gravely overweight

Input:
weights (in kilograms),
heights (in meters).

process:
BMI = weight/(height*height)

Output:
BMI of the students, and its interpretation.

*/

#include <iostream>
using namespace std;
#include <iomanip>

const int NUMBER_OF_STUDENTS = 2; //number of students = 20 students

//void readData();
void readData(double W[NUMBER_OF_STUDENTS],
double H[NUMBER_OF_STUDENTS]);
//void readData(double W[], double H[], int size);

void calBMI(double weight, double height, double Tbmi[], int index);
void display(const double T[],  int size);
void interpreteBMI(double number);

//Additional functions:
double getNumber();
void Print(const double W[], const double H[],  int size);
void Print(const double T[],  int size);

int main()
{
//data declaration:
double studWeight[NUMBER_OF_STUDENTS];
double studHeight[NUMBER_OF_STUDENTS];
double studBMI[NUMBER_OF_STUDENTS];

//input:
readData(studWeight, studHeight);

//process:
//to set bmi for each student:
for(int rowindex = 0; rowindex < NUMBER_OF_STUDENTS; rowindex++)
{
calBMI(studWeight[rowindex], studHeight[rowindex], studBMI,
rowindex);
}

//output:
display(studBMI,  NUMBER_OF_STUDENTS);

return 0;
} //end main

//Function definition:

//Function 3:
//This function displays the BMI of the students, and its interpretation.
void display(const double T[],  int size)
{
for(int rowindex = 0; rowindex < size; rowindex++)
{
cout << "\t BMI of the student-" << rowindex+1 << ": " ;
cout << fixed <<setprecision(2) << setw(5) << T[rowindex];
interpreteBMI(T[rowindex]);
cout << endl;
}
cout << endl;
}

void interpreteBMI(double bmi)
{
if (bmi < 16)
cout << " You are seriously underweight";
else if (bmi < 18)
cout << " You are underweight";
else if(bmi < 24)
cout << " You are normal weight";
else if (bmi < 29)
cout << " You are overweight";
else if (bmi < 35)
cout << " You are seriously overweight";
else
cout << " You are gravely overweight";
}

//Function 2:
void calBMI(double weight, double height, double Tbmi[], int index)
{
double bmi = weight/(height*height);
Tbmi[index] = bmi;

}

//Function 1:
void readData(double W[NUMBER_OF_STUDENTS], double
H[NUMBER_OF_STUDENTS])
{
cout << "\n\t You will be asked to enter weight and height for "
<< NUMBER_OF_STUDENTS << " students. " << endl;
for(int rowindex = 0; rowindex < NUMBER_OF_STUDENTS ; rowindex++)
{
cout << "Enter the weight for student-" << rowindex+1 << ": ";
W[rowindex] = getNumber();
cout << "Enter the height for student-" << rowindex+1 << ": ";
H[rowindex] = getNumber();
}
}

//Input validation: value > 0.0
double getNumber()
{
double number;
while(!(cin >> number) || number < 0.0 )
{
cin.clear();
cin.ignore(100, '\n');
cout << "\n\t Enter positive number: ";
}
return number;
}

void Print(const double W[], const double H[],  int size)
{
for(int rowindex = 0; rowindex < size; rowindex++)
{
cout << "\t";
cout << fixed << setprecision(2) << setw(5) << W[rowindex]
<< setw(5) << H[rowindex] << endl;
}
cout << endl;
}

void Print(const double T[], int size)
{
for(int rowindex = 0; rowindex < size; rowindex++)
{
cout << "\t";
cout << fixed <<setprecision(2) << setw(5) << T[rowindex] << endl;
}
cout << endl;
}

# data[].attributes.headline
Kamarul Shazry bin Kamaludin (b011610268)

# data[].attributes.subject
Kamarul Shazry bin Kamaludin (b011610268)

# data[].attributes.body
ex.3 pg 67

# data[].attributes.attachment_link.readable_text
#include<iostream>
using namespace std;

int main()
{
	double floor, room, i, oc_room, tot_room, tot_oc, tot_unoc;
	double percentage;
	
	cout<<"Enter no. of rooms for floor:"<<endl;
	cin>>floor;
	
	for(i=1;i<=floor;i++)
	{
		cout<<"Enter no. of room for floor"<<i<<endl;
		cin>>room;
		
		cout<<"Enter no. of occupied room for floor"<<i<<endl;
		cin>>oc_room;
		
		tot_room=tot_room+room;
		tot_oc+=oc_room;
	}
	
	tot_unoc = tot_room - tot_oc;
	
	cout<<"Total room for every floor is"<<tot_room<<endl;
	cout<<"Total occupied room is"<<tot_oc<<endl;
	cout<<"Total unoccupied room is"<<tot_unoc<<endl;
	
	percentage = (tot_oc/tot_room)*100;
	
	cout<<"Percentage of occupied room is"<<percentage<<endl;
	
	return 0;
}


# data[].attributes.headline
Kamarul Shazry bin Kamaludin (b011610268)

# data[].attributes.subject
Kamarul Shazry bin Kamaludin (b011610268)

# data[].attributes.body
ex.3pg 55

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<cmath>
using namespace std;

int main()
{
	double eyesA, nosechinA, ratio_A, 
	       eyesB, nosechinB, ratio_B,
		   eyesC, nosechinC, ratio_C;
	float d11, d12, d13;
	int distance;
	
	cout<<"Input value in cm"<<endl<<endl;
	cout<<"Input eye distance and nose to chin distance for image 1: ";
	cin>>eyesA>>nosechinA;
	
	ratio_A = eyesA/nosechinA;
	
	cout<<"Input eye distance and nose to chin distance for image 2: ";
	cin>>eyesB>>nosechinB;
	
	ratio_B = eyesB/nosechinB;
	
	cout<<"Input eye distance and nose to chin distance for image 3: ";
	cin>>eyesC>>nosechinC;
	
	ratio_C = eyesC/nosechinC;
	
	d11 = fabs (ratio_A - ratio_B);
	d12 = fabs (ratio_A - ratio_C);
	d13 = fabs (ratio_A - ratio_C);
	
	if ((d11<=d12) && (d11<=d13))
	{
		cout<<"Best matches is between image 1 and 2 \n";
	}
	if ((d12<=d11) && (d12<=d13))
	{
		cout<<"Best matches is between image 1 and 3 \n";
	}
	if ((d13<=d12) && (d13<=d11))
	{
		cout<<"Best matches is between image 2 and 3 \n";
	}
	
	return 0;
}

# data[].attributes.headline
Kamarul Shazry bin Kamaludin (b011610268)

# data[].attributes.subject
Kamarul Shazry bin Kamaludin (b011610268)

# data[].attributes.body
ex.2 pg 136

# data[].attributes.attachment_link.readable_text
#include<iostream>
using namespace std;
void readData(int sMarks[20][5]);
void calTotMarks(int sMarks[20][5],int tMarks[]);
void display(int sMarks[20][5],int tMarks[]);
int main()
{
	int sMarks[20][5],tMarks[20];
	readData(sMarks);
	calTotMarks(sMarks,tMarks);
	display(sMarks,tMarks);
	return 0;
}

void readData(int sMarks[20][5])
{
	for(int i=0;i<=20;i++)
	{
		cout<<"Student for number "<<i+1<<".\n";
		for(int j=0;j<5;j++)
		{
			cout<<"Mark for the subject number"<<j+1<<": ";
			cin>>sMarks[i][j];
		}
		cout<<endl;
	}
}

void calTotMarks(int sMarks[20][5],int tMarks[])
{
	for(int i=0;i<=20;i++)
	{
		tMarks[i]=0;
		for(int j=0;j<5;j++)
		tMarks[i]+=sMarks[i][j];
	}
}

void display(int sMarks[20][5],int tMarks[])
{
	for(int i=0;i<=20;i++)
	{
		cout<<"The student number "<<i+1<<".\n";
		for(int j=0;j<5;j++)
		{
			cout<<"\tMark for the subject number "<<j+1<<": "<<sMarks[i][j]<<endl;
		}
		cout<<"\tTotal of marks : "<<tMarks[i]<<endl<<endl;
	}
}

# data[].attributes.body
pg 136 question2
LIM JIA HUEY
B011610048

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>
using namespace std;
const int NUMBER_OF_STUDENT = 20;
const int NUMBER_OF_SUBJECT = 5;

float totMarks(float []);
float studMarks(float []);

int main()
{
	float studMarks[NUMBER_OF_STUDENT][NUMBER_OF_SUBJECT] = {0};
	
	cout<<"The marks of the students : "<<endl;
	for(int count_1=0 ; count_1<20 ; count_1++)
	{
		cout<<"The marks that student score "<<count_1+1<<" . "<<endl;
		cout<<"Subject 1 = ";
		cin>>studMarks[count_1][0];
		cout<<"Subject 2 = ";
		cin>>studMarks[count_1][1];
		cout<<"Subject 3 = ";
		cin>>studMarks[count_1][2];
		cout<<"Subject 4 = ";
		cin>>studMarks[count_1][3];
		cout<<"Subject 5 = ";
		cin>>studMarks[count_1][4];
	}
	
	cout<<"Result sheet "<<endl;
	cout<<"Student No.  Subject 1 Subject 2 Subject 3 Subject 4 Subject 5 ";
	cout<<"Total marks"<<endl;
	
	for(int count_2=0 ; count_2<20 ; count_2++)
	{
		cout<<setw(5)<<count_2+1;
		cout<<setw(10)<<studMarks[count_2][0];
		cout<<setw(10)<<studMarks[count_2][1];
		cout<<setw(10)<<studMarks[count_2][2];
		cout<<setw(10)<<studMarks[count_2][3];
		cout<<setw(10)<<studMarks[count_2][4];
		cout<<setw(10)<<totMarks(studMarks[count_2]);
		cout<<endl;
	}
	
	return 0;
}

float totMarks(float studMarks[])
{
	float totMarks = 0;
	
	for(int count=0 ; count<4 ; count++)
	totMarks += studMarks[count];
	
	return totMarks;
}

# data[].attributes.body
pg67 question 3
LIM JIA HUEY
B01161

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
	double number_of_floor, number_of_rooms ;
	double number_of_room_occupied, room_unoccupied, floor ;
	double total_room ;
	double total_rooms_occupied ;
	float percentage_of_room_occupied ;
	
	for (int floor=1; floor <= 5; floor++)
	{
	   cout<<"Number of rooms per floor = "<<endl ;
	   cin>>number_of_rooms ;
       cout<<"Occupied room per floor = "<<endl ;
	   cin>>number_of_room_occupied ; 
    }
    
    total_room = (number_of_rooms*5) ;
	total_rooms_occupied = (number_of_room_occupied*5) ; 
	room_unoccupied = total_room - total_rooms_occupied ;
	percentage_of_room_occupied = (( total_rooms_occupied / total_room ) * 100);
	
	cout<< setprecision(2);
	cout<<"Total room of hotels : " << total_room<<endl;
	cout<<"Total occupied room : " << total_rooms_occupied << endl;
	cout<<"Total unoccupied room : "<< room_unoccupied << endl;
	cout<<"Percentage of rooms have occupied : " << percentage_of_room_occupied <<"%"<< endl;
	
}

# data[].attributes.body
pg 67 question 3
LIM JIA HUEY
B011610048

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
	double number_of_floor, number_of_rooms ;
	double number_of_room_occupied, room_unoccupied, floor ;
	double total_room ;
	double total_rooms_occupied ;
	float percentage_of_room_occupied ;
	
	for (int floor=1; floor <= 5; floor++)
	{
	   cout<<"Number of rooms per floor = "<<endl ;
	   cin>>number_of_rooms ;
       cout<<"Occupied room per floor = "<<endl ;
	   cin>>number_of_room_occupied ; 
    }
    
    total_room = (number_of_rooms*5) ;
	total_rooms_occupied = (number_of_room_occupied*5) ; 
	room_unoccupied = total_room - total_rooms_occupied ;
	percentage_of_room_occupied = (( total_rooms_occupied / total_room ) * 100);
	
	cout<< setprecision(2);
	cout<<"Total room of hotels : " << total_room<<endl;
	cout<<"Total occupied room : " << total_rooms_occupied << endl;
	cout<<"Total unoccupied room : "<< room_unoccupied << endl;
	cout<<"Percentage of rooms have occupied : " << percentage_of_room_occupied <<"%"<< endl;
	
}

# data[].attributes.body
BRIYATHARSINI RAMU (B011410312)

# data[].attributes.body
//page 136 - exercise 1

/*
File name: p136e1.cpp
Body Mass Index (BMI) is a measure of health on weight.
It can be calculated by taking your weight in kilograms and
dividing by the square of your height in metres.
Write a program that lets a teacher to calculate the BMI of 20 students.
The program should use three one dimensional ARRAYS named studWeight
that holds the weight (in kilograms), studHeight that holds the height (in meters)
and studBMI that holds the calculated BMI for each student.
The program contains the following functions:

a) readData: This function receives the studWeight and studHeight ARRAYS

from the main function. It reads the weight and height for all the students

and stored them in the studWeight and studHeight ARRAYS, respectively.

b) calBMI: This function receives one element of the studWeight and
studHeight ARRAYS. It calculates the BMI of each student
based on her/his weight and height, and then store the BMI in the studBMI
ARRAY.

c) display: This function displays the BMI of the students.

Input:
weights (in kilograms),
height (in meters).

process:
BMI = weight/(height*height)

Output:
BMI of the students
*/

#include <iostream>
using namespace std;
#include <iomanip>

const int NUMBER_OF_STUDENTS = 20; //number of students = 20 students

void readData(double W[NUMBER_OF_STUDENTS],
double H[NUMBER_OF_STUDENTS]);

void calBMI(double weight, double height, double Tbmi[], int index);
void display(const double T[],  int size);

//Additional functions:
double getNumber();
void Print(const double W[], const double H[],  int size);
void Print(const double T[],  int size);

int main()
{
//data declaration:
double studWeight[NUMBER_OF_STUDENTS];
double studHeight[NUMBER_OF_STUDENTS];
double studBMI[NUMBER_OF_STUDENTS];

//input:
readData(studWeight, studHeight);

//process:
//to set bmi for each student:
for(int rowindex = 0; rowindex < NUMBER_OF_STUDENTS; rowindex++)
{
calBMI(studWeight[rowindex], studHeight[rowindex], studBMI,
rowindex);
}

//for testing readData and calBMI functions ONLY
//Print(studWeight, studHeight,  NUMBER_OF_STUDENTS);
//Print(studBMI,  NUMBER_OF_STUDENTS);

//output:
display(studBMI,  NUMBER_OF_STUDENTS);

return 0;
} //end main

//Function definition:
//Function 3:
//This function displays the BMI of the students.
void display(const double T[],  int size)
{
for(int rowindex = 0; rowindex < size; rowindex++)
{
cout << "\t BMI of the student-" << rowindex+1 << ": " ;
cout << fixed <<setprecision(2) << setw(5) << T[rowindex] << endl;
}
cout << endl;
}

//Function 2:
void calBMI(double weight, double height, double Tbmi[], int index)
{
double bmi = weight/(height*height);
Tbmi[index] = bmi;
}

//Function 1:
void readData(double W[NUMBER_OF_STUDENTS],
double H[NUMBER_OF_STUDENTS])
{
for(int rowindex = 0; rowindex < NUMBER_OF_STUDENTS ; rowindex++)
{
cout << "Enter the weight for student-" << rowindex+1 << ": ";
//cin >> W[rowindex];
W[rowindex] = getNumber();
cout << "Enter the height for student-" << rowindex+1 << ": ";
//cin >> H[rowindex];
H[rowindex] = getNumber();
}
}

//Additional functions:

//Input validation: value > 0.0
double getNumber()
{
double number;
while(!(cin >> number) || number < 0.0 )
{
cin.clear();
cin.ignore(100, '\n');
cout << "\n\t Enter positive number: ";
}
return number;
}

void Print(const double W[], const double H[],  int size)
{
for(int rowindex = 0; rowindex < size; rowindex++)
{
cout << "\t";
cout << fixed << setprecision(2) << setw(5) << W[rowindex]
<< setw(5) << H[rowindex] << endl;
}
cout << endl;
}

void Print(const double T[], int size)
{
for(int rowindex = 0; rowindex < size; rowindex++)
{
cout << "\t";
cout << fixed <<setprecision(2) << setw(5) << T[rowindex] << endl;
}
cout << endl;
}

# data[].attributes.headline
Lab Assessment Week 10  7-11 Nov 2016, submit on Monday, 14 Nov 2016.

# data[].attributes.subject
Lab Assessment Week 10  7-11 Nov 2016, submit on Monday, 14 Nov 2016.

# data[].attributes.body
//page 136 - exercise 2

/*
File name: p136e2.cpp

Write a program to keep track of the marks for 5 subjects
taken by 20 students. The program will also calculate
the total marks of each student. The program should use
TWO dimensional ARRAY named studMarks that holds
the mark for each subject taken by the students and
a ONE dimensional ARRAY named totMarkss that holds
the total marks for all the subjects of each student.
The program contains the following functions:
a) readData: This function receives the studMarks array.
It reads marks for each subject of the students and
stored them in the studMarks ARRAY.

b) calTotMarks: This function receives a row of
the studMarks ARRAY and the totMarks ARRAY.
It calculates the total marks for all the subjects
of a student and store the total marks in the totMarks ARRAY.

c) display: This function displays the marks for
each subject of the students and
the total marks for all the subjects of each student.
*/

#include <iostream>
using namespace std;
#include <iomanip>

const int MAX_ROWS = 2; //20
const int MAX_COLS = 2; //5

void readData(double A[MAX_ROWS][MAX_COLS]);
void readData(double A[MAX_ROWS][MAX_COLS], int N, int M);
void calTotMarks(const double A[MAX_ROWS], double B[MAX_ROWS],
int rowindex);
void display(const double A[MAX_ROWS][MAX_COLS], const double
B[MAX_ROWS]);

//Additional function is used to test the above functions
void Print(double A[MAX_ROWS][MAX_COLS],int N, int M);
void Print(double A[MAX_ROWS],int N);
double getMark();

int main()
{
//the marks for 5 subjects taken by 20 students.
double studMarks[MAX_ROWS][MAX_COLS];

//holds the total marks for all the subjects of each student.
double totMarks[MAX_ROWS];

//init array
cout << "\n\t Init Marks: " << endl;

//either one:
//readData(studMarks,MAX_ROWS,MAX_COLS);
readData(studMarks);

cout << "\n\t Display Marks already initialized: " << endl;
Print(studMarks,MAX_ROWS,MAX_COLS);

//calculate total marks for each student.
for (int rowindex = 0; rowindex < MAX_ROWS; rowindex++)
{
calTotMarks(studMarks[rowindex],totMarks, rowindex);
}

cout << "\n\t Display total Marks for each student: " << endl;
Print(totMarks,MAX_ROWS);
cout << endl << endl;
cout << "\n\t Display the marks and total Marks for each student: " << endl;
display(studMarks, totMarks);

return 0;
} //end main

//write the body of each function below:
//write your answer on A4 paper.

# data[].attributes.body
B011610018

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
float getJudgeData();
float calcScore();
float findLowest();
float findHighest();
void displayOutput(float getJudgeData , float calcScore);

int main()
{
	int test1 , test2 , test3 , test4 , test5 , i ;
	double score , judgedata , highest_score , lowest_score ;
	float average ;
	for(i=0 ; i<5 ; i++)
	
	{
		test1=getJudgeData();
		test2=getJudgeData();
		test3=getJudgeData();
		test4=getJudgeData();
		test5=getJudgeData();
		
		average = ((test1 + test2 + test3 + test4 + test5) - lowest_score - highest_score);
		cout<<"Averge score is : "<<average<<endl;
	}
	return 0;
}

float getJudgeData()
{
	int i;
	float score;
	for (i=0 ; i<5 ; i++)
	{
		cout<<"Enter a score : "<<endl;
		cin>>score;
	}
	while (score<0 || score>10)
	{
		cout<<"Test score range from 0 - 10 . "<<endl;
		cout<<"Please enter a score . "<<endl;
		cin>>score;
	}
}

float findLowest()
{
	int test1, test2, test3, test4, test5;
	float lowest = test1;
	
	if (lowest > test2)
    lowest = test2;
    if (lowest > test3)
    lowest = test3;
    if (lowest > test4)
    lowest = test4;
    if (lowest > test5)
    lowest = test5;
}

float findHighest()
{
	int test1, test2, test3, test4, test5;
	float highest = test5;
	
	if (highest < test4)
    highest = test4;
    if (highest < test3)
    highest = test3;
    if (highest < test2)
    highest = test2;
    if (highest < test1)
    highest = test1;
}

void displayOutput(float getJudgeData , float calcScore)
{
	float tScore , average , getjudge , lowest_score , highest_score ;
	float score1 , score2 , score3 , score4 , score5 ; 
	
	cout<<tScore<<endl;
    cout<<average<<endl;
    cout<<getjudge<<endl;
    cout<<lowest_score<<endl;
    cout<<highest_score<<endl;
    cout<<score1<<endl;
    cout<<score2<<endl;
    cout<<score3<<endl;
    cout<<score4<<endl;
    cout<<score5<<endl;
}

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

int main()
{
	double eyetoeye, nosetochin;
	
	cout<<"Enter the distance between your eyes.(cm): ";
	cin>>eyetoeye;
	
	cout<<"Enter the distance between your nose and your chin.(cm): ";
	cin>>nosetochin;
	
	cout<<"The ratio is : "<< 
	eyetoeye/nosetochin;
	
	return 0;
}

# data[].attributes.body
B011610071
EXERCISE PAGE 67

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int main ()

{
	double TotalRoom, Room, UnoccupiedRoom, Percentage, i, RoomOccupied,
			Floor, TotalRoomOccupied;
	cout << "How many floor does the hotel has: ";
	cin >> Floor;
	
	for (i = 1; i <= Floor; i++)
	
	{
		cout << "How many rooms for floor "<< i << endl;
		cin >> Room;
		
		cout << "How many rooms are occupied\n ";
		cin >> RoomOccupied;
		
		TotalRoom = TotalRoom + Room;
		TotalRoomOccupied = TotalRoomOccupied + RoomOccupied;
		UnoccupiedRoom = TotalRoom - TotalRoomOccupied;	
	}
	
	Percentage = (TotalRoomOccupied/TotalRoom) * 100;
	
	cout << "Total Room				: " << TotalRoom << endl;
	cout << "Total Room Occupied	: " << TotalRoomOccupied << endl;
	cout << "Total Room Unoccupied	: " << UnoccupiedRoom << endl;
	cout << "Percentage 			: " << Percentage << endl;
	
	return 0;
}


# data[].attributes.body
B011610071
EXERCISE PAGE 55

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <cmath>
using namespace std;


int main ()

{
	double eyes_1, eyes_2, eyes_3, nose_chin_1, nose_chin_2, nose_chin_3, ratio_1, ratio_2, ratio_3;
	float diff_12, diff_13, diff_23;
	int distance;
	
	cout << "Enter value in cm" << endl << endl;
	
	cout << "Enter eye distance and nose to chin distance for image 1:  " << distance << " ";
	cin >> eyes_1 >> nose_chin_1;
	
	ratio_1 = eyes_1/nose_chin_1;
	
	cout << "Enter eye distance and nose to chin distance for image 2:  " << distance << " ";
	cin >> eyes_2 >> nose_chin_1;
	
	ratio_2 = eyes_2/nose_chin_2;
	
	cout << "Enter eye distance and nose to chin distance for image 3:  " << distance << " ";
	cin >> eyes_3 >> nose_chin_3;
	
	ratio_3 = eyes_3/nose_chin_3;
	
	diff_12 = (ratio_1 - ratio_2);
	diff_13 = (ratio_1 - ratio_3);
	diff_23 = (ratio_2 - ratio_3);
	
	if ((diff_12 <= diff_13) && (diff_12 <= diff_23))
	
	{
		cout << "Best matches is between image 1 and 2 \n" ;
	}
	
	if ((diff_13 <= diff_12) && (diff_13 <= diff_23))
	{
		cout << "Best matches is between image 1 and 3 \n" ;
	}
	
	if ((diff_23 <= diff_13) && (diff_23 <= diff_12))
	{
		cout << "Best matches is between image 2 and 3 \n" ;
	}
	
	return 0;
}

# data[].attributes.body
IRA NATRIATUL SHIZZA BT SUHARDI
B011610126

LAB TEST FRIDAY 4/11/2016

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>
using namespace std;

//Function prototypes
void getJudgeData (double & someValue);
double calcScore (double a,double b, double c, double d, double e);
double findLowest(double aa, double bb, double cc, double dd, double ee);
double findHighest ( double aaa, double bbb, double ccc, double ddd, double eee);

int main ()
{ double scores, avgValue, judge1, judge2, judge3, judge4, judge5;

    //Ask for the score of each judges
	getJudgeData(scores);
	judge1 = scores;
	cout << judge1 << endl;
    getJudgeData(scores);
	judge2 = scores;
	cout << judge2 << endl;
	getJudgeData(scores);
	judge3 = scores;
	cout << judge3 << endl;
	getJudgeData(scores);
	judge4 = scores;
	cout << judge4 << endl;
	getJugdeData(scores);
	judge5 = scores;
	cout << judge5 << endl;

	//Outputs the average value
	avgValue = calcScore (judge1, judge2, judge3, judge4, judge5);
	cout << avgValue;

	return 0;
}


/*getJugdeData asls the user for a score between 1 and 10
  gets store in a reference value and volidates the input.*/
void getJugdeData(double&someValue)
{   cout << "Enter input of your score from 1-10";
    cin >> someValue;
	if (someValue <1 || someValue >10)
	{  cout << "Please enter a valid score from 1-10";
	}
	else {
		someValue;
	}

}

/* calcScore calculates and return the average of 4 scores that remain after dropping the highest and lowest scores of the performer received.*/
double calcScore(double a, double b, double c, double d, double e)
{   double rtValue;
    double lowScore = findLowest (a, b, c, d, e);
	double highScore = findHighest (a, b, c, d, e);

	rtValue = ((a + b + c + d + e) - (lowScore + highScore)) / 3;

	return rtValue;
}

double findLowest (double aa, double bb, double cc, double dd, double ee)
{
	double lowestScore;

	if ((aa< bb) && (aa< cc) && (aa< dd) && (aa< ee)) { 
		 lowestScore = aa;
	 }
	 else if ((bb< aa) && (bb< cc) && (bb< dd) && (bb< ee)) {
		 lowestScore = bb;
	 }
	 else if ((cc< aa) && (cc< bb) && (cc< dd) && (cc< ee)) {
		 lowestScore = cc;
	 }
	 else if ((dd< aa) && (dd< bb) && (dd< cc) && (dd< ee)) {
		 lowestScore = dd;
	 }
	 else if ((ee< aa) && (ee< bb) && (ee< cc) && (ee< dd))
	 { 
		 lowestScore = ee;
	 }
	 return lowestScore;
}


double findHighest (double aaa, double bbb, double ccc, double ddd, double eee)
{
	double highestScore;

	if ((aaa> bbb) && (aaa> ccc) && (aaa> ddd) && (aaa> eee)){ 
		highestScore = aaa;
	}
	else if ((bbb> aaa) && (bbb> ccc) && (bbb> ddd) && (bbb> eee)){
		highestScore = bbb;
	}
	else if ((ccc> aaa) && (ccc> bbb) && (ccc> ddd) && (ccc> eee))
	{
		highestScore = ccc;
	}

	else if ((ddd> aaa) && (ddd> bbb) && (ddd> ccc) && (ddd> eee)){
		highestScore = ddd;
	}
else if ((eee> aaa) && (eee> bbb) && (eee> ccc) && (eee> ddd))
	{
		highestScore = eee;
	}
	return highestScore;
}

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

# data[].attributes.body
Lap Test

# data[].attributes.attachment_link.readable_text


#include <iostream>
using namespace std;

using namespace std;

void getJudgeData(double &);
void calcScore(double, double, double, double, double);
double findLowest(double, double, double, double, double);
double findHighest(double, double, double, double, double);

int main()
{
 double score1, score2, score3, score4, score5;
 
 cout << " Judge 1: " << endl;
 getJudgeData(score1);

 cout << "\n Judge 2: " << endl;
 getJudgeData(score2);

 cout << "\n Judge 3: " << endl;
 getJudgeData(score3);

 cout << "\n Judge 4: " << endl;
 getJudgeData(score4);

 cout << "\n Judge 5: " << endl;
 getJudgeData(score5);

 calcScore(score1, score2, score3, score4, score5);

}

void getJudgeData(double &refVar)
{
 cout << " What is the judge's score? ";
 cin >> refVar;
 while(refVar < 0 || refVar > 10)
 {
 cout << " The Judge cannot give a score lower than 0, or higher than 10.\n";
 cout << " What is the Judge's score? ";
 cin >> refVar;
 }
}

void calcScore(double score_1, double score_2, double score_3, double score_4, double score_5)
{
 cout << "\n The highest and lowest scores will be dropped." << endl;
 findLowest(score_1, score_2, score_3, score_4, score_5);
 findHighest(score_1, score_2, score_3, score_4, score_5);
 cout << "\n The remaining scores will be averaged. " << endl;
}

double findLowest(double num1, double num2, double num3, double num4, double num5)
{
 if(num1 < num2 && num1 < num3 && num1 < num4 && num1 < num5)
 {
 cout << " The lowest Judge score is " << num1 << endl;
 return num1;
 }
 else if(num2 < num3 && num2 < num4 && num2 < num5 && num2 < num1)
 {
 cout << " The lowest Judge score is " << num2 << endl;
 return num2;
 }
 else if(num3 < num4 && num3 < num5 && num3 < num1 && num3 < num2)
 {
 cout << " The lowest Judge score is " << num3 << endl;
 return num3;
 }
 else if(num4 < num5 && num4 < num1 && num4 < num2 && num4 < num3)
 {
 cout << " The lowest Judge score is " << num4 << endl;
 return num4;
 }
 else if(num5 < num1 && num5 < num2 && num5 < num3 && num5 < num4)
 {
 cout << " The lowest Judge score is " << num5 << endl;
 return num5;
 }

 return 0;
}

double findHighest(double num1, double num2, double num3, double num4, double num5)
{
 if(num1 > num2 && num1 > num3 && num1 > num4 && num1 > num5)
 {
 cout << " The highest Judge score is " << num1 << endl;
 return num1;
 }
 else if(num2 > num3 && num2 > num4 && num2 > num5 && num2 > num1)
 {
 cout << " The highest Judge score is " << num2 << endl;
 return num2;
 }
 else if(num3 > num4 && num3 > num5 && num3 > num1 && num3 > num2)
 {
 cout << " The highest Judge score is " << num3 << endl;
 return num3;
 }
 else if(num4 > num5 && num4 > num1 && num4 > num2 && num4 > num3)
 {
 cout << " The highest Judge score is " << num4 << endl;
 return num4;
 }
 else if(num5 > num1 && num5 > num2 && num5 > num3 && num5 > num4)
 {
 cout << " The highest Judge score is " << num5 << endl;
 return num5;
 }

 return 0;
}

# data[].attributes.body
NURUL FATIN FATIHAH BINTI MOHAMAD SHABANA
B0116100996
LAB TEST 4/11/2016 (JUMAAT)

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>
using namespace std;


void getJudgeData(double &someValue);
double calcScore(double a, double b, double c, double d, double e);
double findLowest(double aa, double bb, double cc, double dd, double ee);
double findHighest(double aaa, double bbb, double ccc, double ddd, double eee);

int main ()
{   double scores, avgValue, judge1, judge2, judge3, judge4, judge5;

    
    getJudgeData(scores);
    judge1 = scores;
    cout << judge1 << endl;
    getJudgeData(scores);
    judge2 = scores;
    cout << judge2 << endl;
    getJudgeData(scores);
    judge3 = scores;
    cout << judge3 << endl;
    getJudgeData(scores);
    judge4 = scores;
    cout << judge4 << endl;
    getJudgeData(scores);
    judge5 = scores;
    cout << judge5 << endl;

    
    avgValue = calcScore(judge1, judge2, judge3, judge4, judge5);
    cout << avgValue;

    return 0;
}



void getJudgeData(double &someValue)
{   cout << "Enter input of your score from 1-10";
    cin >> someValue;
    if (someValue < 1 || someValue > 10) 
    { cout << "Please enter a valid score from 1-10";
      cin >> someValue;
    }
    else {
      someValue;
    }
}


double calcScore(double a, double b, double c, double d, double e)
{   double rtValue;
    double lowScore = findLowest(a, b, c, d, e);
    double highScore = findHighest(a, b, c, d, e);

    rtValue = ((a + b + c + d + e) - (lowScore + highScore))  / 3;

    return rtValue;
}

double findLowest (double aa, double bb, double cc, double dd, double ee)
{   
    double lowestScore;

    if ((aa < bb) && (aa < cc) && (aa < dd) && (aa < ee)) {
    lowestScore = aa;
    }
    else if ((bb < aa) && (bb < cc) && (bb < ee) && (bb < ee)) {
    lowestScore = bb;
    }
    else if ((cc < aa) && (cc < bb) && (cc < dd) && (cc < ee)) {
    lowestScore = cc;
    }
    else if ((dd < aa) && (dd < bb) && (dd < cc) && (dd < ee)) {
    lowestScore = dd;
    }
    else if ((ee < aa) && (ee < bb) && (ee < cc) && (ee < dd)) {
    lowestScore = ee;
    }
    return lowestScore;
}

double findHighest (double aaa, double bbb, double ccc, double ddd, double eee)
{   
    double highestScore;

    if ((aaa > bbb) && (aaa > ccc) && (aaa > ddd) && (aaa > eee)) {
    highestScore = aaa;
    }
    else if ((bbb > aaa) && (bbb > ccc) && (bbb > eee) && (bbb > eee)) {
    highestScore = bbb;
    }
    else if ((ccc > aaa) && (ccc > bbb) && (ccc < ddd) && (ccc > eee)) {
    highestScore = ccc;
    }
    else if ((ddd > aaa) && (ddd > bbb) && (ddd > ccc) && (ddd > eee)) {
    highestScore = ddd;
    }
    else if ((eee > aaa) && (eee > bbb) && (eee > ccc) && (eee > ddd)) {
    highestScore = eee;
    }
    return highestScore;
    
	}

# data[].attributes.body
Mohammad Faisal bin mat sulaiman

# data[].attributes.attachment_link.readable_text
/*Program that calculates the balance of a saving account at the end of a period of time*/
#include<iostream>
using namespace std;
int main()
{
float annual_interest_rate, starting_balance, months, balance_A, deposit, withdrawl, balance_B, monthly_interest_rate, ending_balance;

cout<<"Enter the amount of deposit for this month: ";
cin>>deposit;
cout<<"Enter the starting balance from this account: ";
cin>>starting_balance;

if((deposit<=0) || (starting_balance<= 0))
	{
	cout << "The account has been closed\n";
	return 0;
	}
	else

balance_A = starting_balance + deposit;

cout<<"Your balance account is "<<balance_A<<endl;

cout<<"Enter the amount withdrawl from this account for this month: ";
cin>>withdrawl;

if (withdrawl<=0)
{
cout << "The account has been closed\n";
	return 0;
	}
	else

balance_B = balance_A - withdrawl;

cout<<"Your balance account is "<<balance_B<<endl;

cout<<"Enter your annual interest rate: ";
cin>>annual_interest_rate;
{
monthly_interest_rate = annual_interest_rate/12;

}
ending_balance = monthly_interest_rate * balance_B;

cout<<"Your ending balance is "<<ending_balance<<endl;
cout<<"Total amount deposited "<<deposit<<endl;
cout<<"Your total amount withdrawl "<<withdrawl<<endl;
cout<<"Your total interest "<<monthly_interest_rate<<endl;

return 0;
}

# data[].attributes.body
lab test 3

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>
using namespace std;

void getJudgeData(double &mark);
double calcScore(double m1, double m2, double m3, double m4, double m5);
double findLowest(double m1, double m2, double m3, double m4, double m5);
double findHighest(double m1, double m2, double m3, double m4, double m5);

int main ()
{   double scores, avgValue, judge1, judge2, judge3, judge4, judge5;

    getJudgeData(scores);
    judge1 = scores;
    cout << "judge1" << endl;
    getJudgeData(scores);
    judge2 = scores;
    cout << "judge2" << endl;
    getJudgeData(scores);
    judge3 = scores;
    cout << "judge3" << endl;
    getJudgeData(scores);
    judge4 = scores;
    cout << "judge4" << endl;
    getJudgeData(scores);
    judge5 = scores;
    cout << "judge5" << endl;

    avgValue = calcScore(judge1, judge2, judge3, judge4, judge5);
    cout << avgValue;

    return 0;
}


void getJudgeData(double &mark)
{   cout << "Enter judge score";
    cin >> mark;
    if (mark < 1 || mark > 10) 
    { cout << "Please enter a valid score from 1-10";
      cin >> mark;
    }
    else {
      mark;
    }
}


double calcScore(double m1, double m2, double m3, double m4, double m5)
{   double rtValue;
    double lowScore = findLowest(m1,m2,m3,m4,m5);
    double highScore = findHighest(m1,m2,m3,m4,m5);

    rtValue = ((m1 + m2 + m3 + m4 + m5) - (lowScore + highScore))  / 3;

    return rtValue;
}

double findLowest (double m1, double m2, double m3, double m4, double m5)
{   
    double lowestScore;

    if ((m1 < m2) && (m1 < m3) && (m1 < m4) && (m1 < m5)) {
    lowestScore = m1;
    }
    else if ((m2 < m1 ) && (m2 < m3 ) && (m2  < m4 ) && (m2  < m5 )) {
    lowestScore = m2 ;
    }
    else if ((m3  < m1 ) && (m3  < m2 ) && (m3 < m4) && (m3 < m5)) {
    lowestScore = m3;
    }
    else if ((m4 < m1) && (m4 < m2) && (m4 < m3) && (m4 < m5)) {
    lowestScore = m4;
    }
    else if ((m5 < m1) && (m5 < m2) && (m5 < m3) && (m5 < m4)) {
    lowestScore = m5;
    }
    return lowestScore;
}

double findHighest (double m1, double m2, double m3, double m4, double m5)
{   
    double highestScore;

    if ((m1 > m2) && (m1 > m3) && (m1 > m4) && (m1 > m5)) {
    highestScore = m1;
    }
    else if ((m2 > m1) && (m2 > m3) && (m2 > m4) && (m2 > m5)) {
    highestScore = m2;
    }
    else if ((m3 > m1) && (m3 > m2) && (m3 < m4) && (m3 > m5)) {
    highestScore = m3;
    }
    else if ((m4 > m1) && (m4 > m2) && (m4 > m3) && (m4 > m5)) {
    highestScore = m4;
    }
    else if ((m5 > m1) && (m5 > m2) && (m5 > m3) && (m5 > m4)) {
    highestScore = m5;
    }
    return highestScore;
}

# data[].attributes.headline
Mohd Akmal Azri bin Azizan (b011610050) (Bekg S1)

# data[].attributes.subject
Mohd Akmal Azri bin Azizan (b011610050) (Bekg S1)

# data[].attributes.body
lab test 1

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>
using namespace std;


void getJudgeData(double &someValue);
double calcScore(double j1, double j2, double j3, double j4, double j5);
double findLowest(double j1, double j2, double j3, double j4, double j5);
double findHighest(double j1, double j2, double j3, double j4, double j5);

int main ()
{   double scores, avgValue, judge1, judge2, judge3, judge4, judge5;

    
    getJudgeData(scores);
    judge1 = scores;
    cout << "judge1" << endl;
    getJudgeData(scores);
    judge2 = scores;
    cout << "judge2" << endl;
    getJudgeData(scores);
    judge3 = scores;
    cout << "judge3" << endl;
    getJudgeData(scores);
    judge4 = scores;
    cout << "judge4" << endl;
    getJudgeData(scores);
    judge5 = scores;
    cout << "judge5" << endl;

   
    avgValue = calcScore(judge1, judge2, judge3, judge4, judge5);
    cout << avgValue;

    return 0;
}



void getJudgeData(double &someValue)
{   cout << "Enter judge score from 1-10:";
    cin >> someValue;
    if (someValue < 1 || someValue > 10) 
    { cout << "Please enter a valid score from 1-10";
      cin >> someValue;
    }
    else {
      someValue;
    }
}


double calcScore(double j1, double j2, double j3, double j4, double j5)
{   double rtValue;
    double lowScore = findLowest(j1, j2, j3, j4, j5);
    double highScore = findHighest(j1, j2, j3, j4, j5);

    rtValue = ((j1 + j2 + j3 + j4 + j5) - (lowScore + highScore))  / 3;
	cout<<"A performer final score:"<<rtValue;
    return rtValue;
}

double findLowest (double j1, double j2, double j3, double j4, double j5)
{   
    double lowestScore;

    if ((j1 < j2) && (j1 < j3) && (j1 < j4) && (j1 < j5)) {
    lowestScore = j1;
    }
    else if ((j2 < j1) && (j2 < j3) && (j2 < j4) && (j2 < j5)) {
    lowestScore = j2;
    }
    else if ((j3 < j1) && (j3 < j2) && (j3 < j4) && (j3 < j5)) {
    lowestScore = j3;
    }
    else if ((j4 < j1) && (j4 < j2) && (j4 < j3) && (j4 < j5)) {
    lowestScore = j4;
    }
    else if ((j5 < j1) && (j5 < j2) && (j5 < j3) && (j5 < j4)) {
    lowestScore = j5;
    }
    return lowestScore;
}

double findHighest (double j1, double j2, double j3, double j4, double j5)
{   
    double highestScore;

    if ((j1> j2) && (j1 > j3) && (j1 >j4) && (j1 >j5)) {
    highestScore = j1;
    }
    else if ((j2 > j1) && (j2> j3) && (j2 > j5) && (j2 > j5)) {
    highestScore = j2;
    }
    else if ((j3 >j1) && (j3> j2) && (j3 <j4) && (j3 > j5)) {
    highestScore = j3;
    }
    else if ((j4> j1) && (j4 > j2) && (j4 > j3) && (j4 > j5)) {
    highestScore =j4;
    }
    else if ((j5 > j1) && (j5 > j2) && (j5 >j3) && (j5>j4)) {
    highestScore = j5;
    }
    return highestScore;
}


# data[].attributes.body
B011610261

# data[].attributes.body
MUHAMMAD ZAKUAN BIN HAMZAH
(B011610197)

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<cmath>
using namespace std;

unsigned int numPerformers;
void getJudgeData(double&);
void calScore(double&,double,double,double,double,double);
double findLowest(double,double,double,double,double);
double findHighest(double,double,double,double,double);


int main()
 {
  
  double j1,j2,j3,j4,j5,avgScr; 
  cout<< " Enter number of performers: " << " ";
  cin>>numPerformers; 
  
  for(int i=0;i<numPerformers;i++)
  {
   getJudgeData(j1);
  getJudgeData(j2);
  getJudgeData(j3);
  getJudgeData(j4);
  getJudgeData(j5);

  
  calScore(avgScr,j1,j2,j3,j4,j5);
  cout<< " Average Score For Performers " << (i+1) << " is " << avgScr << " points " << endl;
   
  }

  return 0;
  }


void getJudgeData(double& mark)
 {   
 	cout << "Enter input of your score from 1-10:";
    cin >> mark;
    if (mark < 1 || mark > 10) 
    { 
	  cout << "Please enter a valid score from 1-10:";
      cin >> mark;
    }
    else 
	{
      mark;
    }
}
 
void calScore(double&avgScore,double m1,double m2,double m3,double m4,double m5)
 { 

  double lowest,highest,dropScore,totalScore;
  totalScore=m1+m2+m3+m4+m5;
 
  lowest=findLowest(m1,m2,m3,m4,m5);
 
  highest=findHighest(m1,m2,m3,m4,m5);
  dropScore=totalScore-(lowest+highest);

  avgScore=dropScore/3;


  
  
 }


double findLowest(double a,double b,double c,double d,double e)
  {
   if((a<b)&&(a<c) && (a<d) && (a<e))
   {
    return a;
   }
  else if((b<a)&& (b<c) && (b<d)&&(b<e))
  {
   return b;
  }
  else if((c<a)&&(c<b)&&(c<d)&&(c<e))
  {
   return c;
  }
 else if((d<a)&&(d<b)&&(d<c)&& (d<e))
 { 
  return d;
 }
 else
 { 
  return e;
 }
}

   
  


double findHighest(double a,double b,double c,double d,double e)
{
   if((a>b)&&(a>c) && (a>d) && (a>e))
   {
    return a;
   }
  else if((b>a)&& (b>c) && (b>d)&&(b>e))
  {
   return b;
  }
  else if((c>a)&&(c>b)&&(c>d)&&(c>e))
  {
   return c;
  }
 else if((d>a)&&(d>b)&&(d>c)&& (d>e))
 { 
  return d;
 }
 else
 { 
  return e;
 }
}

# data[].attributes.headline
AIMAN ABOBAKR SALEM BA QASI  -  B011610242  -  LAB TEST - STAR SEARCH 

# data[].attributes.subject
AIMAN ABOBAKR SALEM BA QASI  -  B011610242  -  LAB TEST - STAR SEARCH 

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;



void getJudgeData(double &);
void calcScore(double, double, double, double, double);
double findLowest(double, double, double, double, double);
double findHighest(double, double, double, double, double);

int main()
{
	double score1, score2, score3, score4, score5;
	
	cout << " Judge 1: " << endl;
	getJudgeData(score1);

	cout << "\n Judge 2: " << endl;
	getJudgeData(score2);

	cout << "\n Judge 3: " << endl;
	getJudgeData(score3);

	cout << "\n Judge 4: " << endl;
	getJudgeData(score4);

	cout << "\n Judge 5: " << endl;
	getJudgeData(score5);

	calcScore(score1, score2, score3, score4, score5);

}

void getJudgeData(double &refVar)
{
	cout << " What is the judge's score? ";
	cin >> refVar;
	while(refVar < 0 || refVar > 10)
	{
		cout << " The Judge cannot give a score lower than 0, or higher than 10.\n";
		cout << " What is the Judge's score? ";
		cin >> refVar;
	}
}

void calcScore(double score_1, double score_2, double score_3, double score_4, double score_5)
{
	cout << "\n The highest and lowest scores will be dropped." << endl;
	findLowest(score_1, score_2, score_3, score_4, score_5);
	findHighest(score_1, score_2, score_3, score_4, score_5);
	cout << "\n The remaining scores will be averaged. " << endl;
}

double findLowest(double num1, double num2, double num3, double num4, double num5)
{
	if(num1 < num2 && num1 < num3 && num1 < num4 && num1 < num5)
	{
		cout << " The lowest Judge score is " << num1 << endl;
		return num1;
	}
	else if(num2 < num3 && num2 < num4 && num2 < num5 && num2 < num1)
	{
		cout << " The lowest Judge score is " << num2 << endl;
		return num2;
	}
	else if(num3 < num4 && num3 < num5 && num3 < num1 && num3 < num2)
	{
		cout << " The lowest Judge score is " << num3 << endl;
		return num3;
	}
	else if(num4 < num5 && num4 < num1 && num4 < num2 && num4 < num3)
	{
		cout << " The lowest Judge score is " << num4 << endl;
		return num4;
	}
	else if(num5 < num1 && num5 < num2 && num5 < num3 && num5 < num4)
	{
		cout << " The lowest Judge score is " << num5 << endl;
		return num5;
	}

	return 0;
}

double findHighest(double num1, double num2, double num3, double num4, double num5)
{
	if(num1 > num2 && num1 > num3 && num1 > num4 && num1 > num5)
	{
		cout << " The highest Judge score is " << num1 << endl;
		return num1;
	}
	else if(num2 > num3 && num2 > num4 && num2 > num5 && num2 > num1)
	{
		cout << " The highest Judge score is " << num2 << endl;
		return num2;
	}
	else if(num3 > num4 && num3 > num5 && num3 > num1 && num3 > num2)
	{
		cout << " The highest Judge score is " << num3 << endl;
		return num3;
	}
	else if(num4 > num5 && num4 > num1 && num4 > num2 && num4 > num3)
	{
		cout << " The highest Judge score is " << num4 << endl;
		return num4;
	}
	else if(num5 > num1 && num5 > num2 && num5 > num3 && num5 > num4)
	{
		cout << " The highest Judge score is " << num5 << endl;
		return num5;
	}

	return 0;
}

# data[].attributes.headline
ABDULLAH HANNAN BIN MOHD ZAIDI B011610166

# data[].attributes.subject
ABDULLAH HANNAN BIN MOHD ZAIDI B011610166

# data[].attributes.body
lab test q1

# data[].attributes.attachment_link.readable_text
#include<iostream>
using namespace std;

int main()
{
	float annual_interest, monthly_interest, starting_balance, ending_balance, total_deposit, total_withdraw, interest_earned, amountd, amountw;
	int monthspassed, i;
	
	do
	{
	cout <<" Enter your annual interest rate:";
	cin >>annual_interest;
	if(annual_interest<0)
	cout << " You need to enter a positive value. \n";
	}while(annual_interest<0);
	
	do
	{
	cout <<" Enter your starting balance:";
	cin >>starting_balance;
	if(starting_balance<0);
	cout << " You need to enter a positive value. \n";
	}while(starting_balance<0);
	
	do
	{
	cout <<" Enter the months passed after the bank was published:";
	cin >>monthspassed;
	if(monthspassed<0)
	cout << " You nedd to enter a positive value. \n";
	}while(monthspassed<0);
	
	for(i=1;i<=monthspassed;i++)
	{
		do
		{
		cout <<" How much you want to deposit:";
		cin >>total_deposit;
		
		if(total_deposit>0)
		amountd=starting_balance+total_deposit;
		else
		cout <<"Invalid input";
		}
		while(total_deposit<0);
		
		do
		{
		cout <<" How much you want to withdraw:";
		cin >>total_withdraw;
		
		if(total_withdraw>0)
		amountw=starting_balance-total_withdraw;
		else
		cout<<"Invalid input";	
		}
		while(total_withdraw<0);
		
		monthly_interest=annual_interest/12;
		ending_balance = starting_balance+monthly_interest;
	}
	
	cout << "Your ending balance: " << ending_balance << endl;
	cout << "Your total deposit: " << total_deposit << endl;
	cout << "Your total withdraw: " << total_withdraw << endl;
	cout << "Your total interest earned: " << monthly_interest << endl;
		
	return 0;	
}

# data[].attributes.body
NUR AINA BT MOHD NOH B011520025

# data[].attributes.attachment_link.readable_text
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    int rainfall[16];
    int data;
	int year;
    char* month_name[16];
    int total_rain = 0;
    int average_rain = 0;
    int totalMonths;


    month_name[1] = "January";
    month_name[2] = "February";
    month_name[3] = "March";
    month_name[4] = "April";
    month_name[5] = "May";
    month_name[6] = "June";
    month_name[7] = "July";
    month_name[8] = "August";
    month_name[9] = "September";
    month_name[10] = "October";
    month_name[11] = "November";
    month_name[12] = "December";

    cout << "This program collects rainfall data of 1 year and shows" << endl;
    cout << "the total, avarage" << endl;
    cout << "Enter rainfall in inches." << endl << endl;
	cout << "Enter number of year" << endl << endl;
	cin >> year;

    for(int month = 1;month < 13;month++)
    {
        cout << "Enter amount of rainfall for " << month_name[month] << ": ";
        cin >> data;
        total_rain += data;
        rainfall[month] = data;
    }

    average_rain = total_rain / 12;

    cout << endl << "Here is your data set: " << endl << endl;

  
    int max = 0;
    int min = 9999;
    int max_counter = 0;
    int min_counter = 0;
    int key = 0;

    range:
    for(int relay2 = 1;relay2 < 13;relay2++)
    {
        if(key == 1 && rainfall[relay2] == max)
        {
            max = rainfall[relay2];
            max_counter++;
        }

        if(rainfall[relay2] > max)
        {
            max = rainfall[relay2];
        }
    }

    for(int relay3 = 1;relay3 < 13;relay3++)
    {
        if(key == 1 && rainfall[relay3] == min)
        {
            min = rainfall[relay3];
            min_counter++;
        }

        if(rainfall[relay3] < min)
        {
            min = rainfall[relay3];
        }
    }

   

    cout << endl;

	totalMonths = year * 12;
	cout << "Total number of months: " << totalMonths << endl;
    cout << "The total amount of rainfall for the year is: " << total_rain << " inches." << endl;
    cout << "The average amount of rainfall for the year is: " << average_rain << " inches." << endl;
    
	getch();
    return 0;
}

# data[].attributes.body
MUHAMMAD SUFYAN BIN MOHD DRUS
B011520020

# data[].attributes.attachment_link.readable_text
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    int rainfall[16];
    int data;
    char* month_name[16];
    int total_rain = 0;
    int average_rain = 0;
	int year;
	int totalMonths;

    month_name[1] = "January";
    month_name[2] = "February";
    month_name[3] = "March";
    month_name[4] = "April";
    month_name[5] = "May";
    month_name[6] = "June";
    month_name[7] = "July";
    month_name[8] = "August";
    month_name[9] = "September";
    month_name[10] = "October";
    month_name[11] = "November";
    month_name[12] = "December";

    cout << "This program collects rainfall data of 1 year and shows" << endl;
    cout << "the total and average." << endl;
    cout << "Enter rainfall in inches." << endl << endl << endl;
	cout << "Enter the number of years." << endl;
	cin >> year;

    for(int month = 1;month < 13;month++)
    {
        cout << "Enter amount of rainfall for " << month_name[month] << ": ";
        cin >> data;
        total_rain += data;
        rainfall[month] = data;
    }

    average_rain = total_rain / 12;

    cout << endl << "Here is your data set: " << endl << endl;

    int max = 0;
    int min = 9999;
    int max_counter = 0;
    int min_counter = 0;
    int key = 0;

    range:
    for(int relay2 = 1;relay2 < 13;relay2++)
    {
        if(key == 1 && rainfall[relay2] == max)
        {
            max = rainfall[relay2];
            max_counter++;
        }

        if(rainfall[relay2] > max)
        {
            max = rainfall[relay2];
        }
    }

    for(int relay3 = 1;relay3 < 13;relay3++)
    {
        if(key == 1 && rainfall[relay3] == min)
        {
            min = rainfall[relay3];
            min_counter++;
        }

        if(rainfall[relay3] < min)
        {
            min = rainfall[relay3];
        }
    }

    cout << endl;
	totalMonths = year * 12;
	cout << "Total number of months: " << totalMonths << endl;
    cout << "The total inches of rainfall per year is: " << total_rain << " inches." << endl;
    cout << "The average amount of rainfall per month is: " << average_rain << " inches." << endl;
   
	getch();
    return 0;
}

# data[].attributes.headline
Lab Test on Thursday, 3rd Nov 2016: AVERAGE RAINFALL

# data[].attributes.subject
Lab Test on Thursday, 3rd Nov 2016: AVERAGE RAINFALL

# data[].attributes.body
NUR AIDA HAZIRAH BINTI CHE ROS
B011520012

# data[].attributes.attachment_link.readable_text
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;

int main(int NumberofAve, char* Ave[])
{
    int rainfall[16];
    int data;
	int year;
    char* month_name[16];
    int total_rain = 0;
    int average_rain = 0;
	int totalMonths;

    month_name[1] = "January" ;
    month_name[2] = "February";
    month_name[3] = "March";
    month_name[4] = "April";
    month_name[5] = "May";
    month_name[6] = "June";
    month_name[7] = "July";
    month_name[8] = "August";
    month_name[9] = "September";
    month_name[10] = "October";
    month_name[11] = "November";
    month_name[12] = "December";

    cout << "This program collects rainfall data of 1 year and shows" << endl;
    cout << "the total and avarage " << endl;
    cout << "Enter rainfall in inches." << endl << endl << endl;
	cout << "Enter number of years: "<< endl;
	cin >> year;

    for(int month = 1;month < 13;month++)
    {
        cout << month_name[month] << ": " <<endl;
        cin >> data;
        total_rain += data;
        rainfall[month] = data;
    }

    average_rain = total_rain / 12;

    cout << endl << "Here is your data set: " << endl << endl;

    int max = 0;
    int min = 9999;
    int max_counter = 0;
    int min_counter = 0;
    int key = 0;

    range:
    for(int relay2 = 1;relay2 < 13;relay2++)
    {
        if(key == 1 && rainfall[relay2] == max)
        {
            max = rainfall[relay2];
            max_counter++;
        }

        if(rainfall[relay2] > max)
        {
            max = rainfall[relay2];
        }
    }

    for(int relay3 = 1;relay3 < 13;relay3++)
    {
        if(key == 1 && rainfall[relay3] == min)
        {
            min = rainfall[relay3];
            min_counter++;
        }

        if(rainfall[relay3] < min)
        {
            min = rainfall[relay3];
        }
    }

  

    cout << endl;

	totalMonths = year * 12;
	cout << "The total number of months " << totalMonths << endl;
    cout << "The total amount of rainfall for the year is: " << total_rain << " inches." << endl;
    cout << "The avarage amount of rainfall for the year is: " << average_rain << " inches." << endl;
 
	getch();
    return 0;
}

# data[].attributes.body
Mohammad Khairul Nizam Bin Amran
B011410205
3BEKG

# data[].attributes.attachment_link.readable_text
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    int rainfall[16];
    int data;
	int year;
	char* month_name[16];
    int total_rain = 0;
    int average_rain = 0;
	int total_month;

    month_name[1] = "January";
    month_name[2] = "February";
    month_name[3] = "March";
    month_name[4] = "April";
    month_name[5] = "May";
    month_name[6] = "June";
    month_name[7] = "July";
    month_name[8] = "August";
    month_name[9] = "September";
    month_name[10] = "October";
    month_name[11] = "November";
    month_name[12] = "December";

    cout << "This program collects rainfall data of 1 year and shows" << endl;
    cout << "the total and average rainfall." << endl;
    cout << "Enter rainfall in inches." << endl << endl <<endl;
	cout << "Enter the number of year:" <<endl;
	cin >> year;

    for(int month = 1;month < 13;month++)
    {
        cout << "Enter amount of rainfall for " << month_name[month] << ": ";
        cin >> data;
        total_rain += data;
        rainfall[month] = data;
    }

    average_rain = total_rain / 12;

    cout << endl << "Here is your data set: " << endl << endl;
   

    int max = 0;
    int min = 9999;
    int max_counter = 0;
    int min_counter = 0;
    int key = 0;

    range:
    for(int relay2 = 1;relay2 < 13;relay2++)
    {
        if(key == 1 && rainfall[relay2] == max)
        {
            max = rainfall[relay2];
            max_counter++;
        }

        if(rainfall[relay2] > max)
        {
            max = rainfall[relay2];
        }
    }

    for(int relay3 = 1;relay3 < 13;relay3++)
    {
        if(key == 1 && rainfall[relay3] == min)
        {
            min = rainfall[relay3];
            min_counter++;
        }

        if(rainfall[relay3] < min)
        {
            min = rainfall[relay3];
        }
    }


    cout << endl;
	total_month =year *12;
	cout << "Total numbers of month;" << total_month << endl;
    cout << "The total amount of rainfall for the year is: " << total_rain << " inches." << endl;
    cout << "The avarage amount of rainfall for the year is: " << average_rain << " inches." << endl;
   
	
    getch();
    return 0;
}

# data[].attributes.attachment_link.readable_text
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;

int main(int NumberofAve, char* Ave[])
{
    int rainfall[16];
    int data;
	int year;
    char* month_name[16];
    int total_rain = 0;
    int average_rain = 0;
	int totalMonths;

    month_name[1] = "January";
    month_name[2] = "February";
    month_name[3] = "March";
    month_name[4] = "April";
    month_name[5] = "May";
    month_name[6] = "June";
    month_name[7] = "July";
    month_name[8] = "August";
    month_name[9] = "September";
    month_name[10] = "October";
    month_name[11] = "November";
    month_name[12] = "December";

    cout << "This program collects rainfall data of 1 year and shows" << endl;
    cout << "the total and avarage " << endl;
    cout << "Enter rainfall in inches." << endl << endl << endl;
	cout << "Enter number of years:" << endl;
	cin >> year;

    for(int month = 1;month < 13;month++)
    {
        cout << "Enter amount of rainfall for " << month_name[month] << ": ";
        cin >> data;
        total_rain += data;
        rainfall[month] = data;
    }

    average_rain = total_rain / 12;
	totalMonths = year * 12;
    cout << endl << "Here is your data set: " << endl << endl;

   
    int max = 0;
    int min = 9999;
    int max_counter = 0;
    int min_counter = 0;
    int key = 0;

    range:
    for(int relay2 = 1;relay2 < 13;relay2++)
    {
        if(key == 1 && rainfall[relay2] == max)
        {
            max = rainfall[relay2];
            max_counter++;
        }

        if(rainfall[relay2] > max)
        {
            max = rainfall[relay2];
        }
    }

    for(int relay3 = 1;relay3 < 13;relay3++)
    {
        if(key == 1 && rainfall[relay3] == min)
        {
            min = rainfall[relay3];
            min_counter++;
        }

        if(rainfall[relay3] < min)
        {
            min = rainfall[relay3];
        }
    }

    cout << endl;
	cout << "Total number of months: " << totalMonths << endl;
    cout << "The total amount of rainfall for the year is: " << total_rain << " inches." << endl;
    cout << "The avarage amount of rainfall for the year is: " << average_rain << " inches." << endl;
 
	getch();
    return 0;
}

# data[].attributes.body
Question3: Average Rainfall

Write progam that uses nested loops to collect data
and calculate the average rainfall over a period of years.
The program should first ask for the number of years.
The outer loop will iterate once for each year.
The inner loop iterate twelve times, once per each month.
Each iteration of the inner loop will ask the user for
the inches of rainfall for that month.

After all iterations, the program should display the number of months,
the total inches of rainfall, and the average rainfall per month for
the entire period.

# data[].attributes.body
lab test question 2
LIM JIA HUEY
B011610048

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int getScore();
void calcAverage();
int findLowest();
void displayOutput(int getScore, float calcAverage, int everage);

int main()
{
	int test1, test2, test3, test4, test5 ,lowest;
    float averageScore;
    for (int i = 0; i < 5; i++) 
    
  {
	test1 = getScore();
    test2 = getScore();
    test3 = getScore();
    test4 = getScore();
    test5 = getScore();

    averageScore = ((test1 + test2 + test3 + test4 + test5) - lowest); 
    cout <<"Average Score is "<< averageScore <<endl;
  }
  
  return 0;
}

int getScore()
{ 
   for (int i = 0; i < 5; i++)
   {
     cout << "Please enter a test score. ";
     cin >> getScore;
   }
   while (getScore < 0 || getScore > 100)
   {
   	  cout << "Valid test scores range from 0 - 100.\n";
      cout << "Please enter a test score. ";
      cin >> getScore;
   }
}

void calcAverage()
{
	int test1, test2, test3, test4, test5;
	float average;
	
	calcAverage = (test1 + test2 + test3 + test4 + test5);
    cout <<"Average Score is "<< calcAverage <<endl;
    cout << "The average of the four highest test scores is "<< average<<endl;
}

int findLowest()
{
	int test1, test2, test3, test4, test5;
	double lowest = test1;
	
	if (lowest > test2)
    lowest = test2;
    if (lowest > test3)
    lowest = test3;
    if (lowest > test4)
    lowest = test4;
    if (lowest > test5)
    lowest = test5;
}

void displayOutput(int getScore, float calcAverage, float everage)
{
	int tScore , average , getScore , lowest ;
	float score1 , score2 , score3 , score4 , score5 ; 
	cout<<tScore<<endl;
    cout<<everage<<endl;
    cout<<getScore<<endl;
    cout<<lowest<<endl;
    cout<<score1<<endl;
    cout<<score2<<endl;
    cout<<score3<<endl;
    cout<<score4<<endl;
    cout<<score5<<endl;
}

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

void getScore(int &);
void calcAverage(int, int, int, int, int);
int findLowest(int, int, int, int, int);

int main()
{
	int Score1,
		Score2,
		Score3,
		Score4, 
		Score5;

	cout << "\nThis program calculates the average of five Scores.\n";


	getScore(Score1);
	getScore(Score2);
	getScore(Score3);
	getScore(Score4);
	getScore(Score5);

	calcAverage(Score1, Score2, Score3, Score4, Score5);
	
	return 0;
}

void getScore(int &Score)
{
	do
	{
		cout << "Enter a test score: ";
		cin  >> Score;

		if (Score < 0 || Score > 100)
		{
			cout << "\nInvaild test score!\n"
				 << "Test score must be greater than 0 and less than 100.Please try again...\n\n";
		}

	} while(Score < 0 || Score > 100);

}

void calcAverage(int Score1, int Score2, int Score3, int Score4, int Score5)
{
	int Lowest; 	
	double Avg;     

	Lowest = findLowest(Score1, Score2, Score3, Score4, Score5);

	if (Lowest == Score1)
		Avg = (Score2 + Score3 + Score4 + Score5)/4;
	else if(Lowest == Score2)
		Avg = (Score1 + Score3 + Score4 + Score5)/4;
	else if(Lowest == Score3)
		Avg = (Score2 + Score1 + Score4 + Score5)/4;
	else if(Lowest == Score4)
		Avg = (Score2 + Score3 + Score1 + Score5)/4;
	else
		Avg = (Score2 + Score3 + Score4 + Score1)/4;
	
	cout << "\nThe average of the four highest scores is "
		 << Avg << ".\n";
}

int findLowest(int Score1, int Score2, int Score3, int Score4, int Score5)
{	
	if (Score1 < Score2 && Score1 < Score3 && Score1 < Score4 &&
	    Score1 < Score5)
		return Score1;
	else if (Score2 < Score1 && Score2 < Score3 && Score2 < Score4 &&
	    Score2 < Score5)
		return Score2;
	else if (Score3 < Score2 && Score3 < Score1 && Score3 < Score4 && 
		Score3 < Score5)
		return Score3;
	else if (Score4 < Score2 && Score4 < Score3 && Score4 < Score1 &&
		Score4 < Score5)
		return Score4;
	else
		return Score5;	
}

# data[].attributes.headline
Faiznur Rahayu Binti Maarupuddin B011210155 LT1Q2

# data[].attributes.subject
Faiznur Rahayu Binti Maarupuddin B011210155 LT1Q2

# data[].attributes.attachment_link.readable_text
//Faiznur Rahayu Binti Maarupuddin
//B 011210155
//Lab Test Question 2


#include <iostream>
using namespace std;

	void getScore(int &);
	void calculateAverage(int, int, int, int, int);
	int findLowest(int, int, int, int, int);


int main()

{

	int Score1, Score2, Score3, Score4, Score5;
		cout << "\nThis programmed will calculated the average of five scores.\n";
		cout << "\n";

			getScore(Score1);
			getScore(Score2);
			getScore(Score3);
			getScore(Score4);
			getScore(Score5);

	calculateAverage(Score1, Score2, Score3, Score4, Score5);

		return 0;

}

	void getScore(int & Score)

{
	do
	{
		cout << "Please enter your test score : ";
		cin >> Score;

	if (Score < 0 || Score > 100)


	{

		cout << " \n Invalid test score! \n " << " Your test score must be greater than 0 and less than 100.\n\n";
	
	}

	} while(Score < 0 || Score > 100);

}

		void calculateAverage(int Score1, int Score2, int Score3, int Score4, int Score5)
	{

		int Lowest; 
		double Avg; 

			Lowest = findLowest(Score1, Score2, Score3, Score4, Score5);

		if (Lowest == Score1)
		Avg = (Score2 + Score3 + Score4 + Score5)/4;

		else if(Lowest == Score2)
		Avg = (Score1 + Score3 + Score4 + Score5)/4;

		else if(Lowest == Score3)
		Avg = (Score2 + Score1 + Score4 + Score5)/4;

		else if(Lowest == Score4)
		Avg = (Score2 + Score3 + Score1 + Score5)/4;

		else
		Avg = (Score2 + Score3 + Score4 + Score1)/4;

				cout << "\nThe average of four highest scores is " << Avg << ".\n\n";

	}

		int findLowest(int Score1, int Score2, int Score3, int Score4, int Score5)

	{ 

		if (Score1 < Score2 && Score1 < Score3 && Score1 < Score4 && Score1 < Score5)

		return Score1;

		else if (Score2 < Score1 && Score2 < Score3 && Score2 < Score4 && Score2 < Score5)

		return Score2;

		else if (Score3 < Score2 && Score3 < Score1 && Score3 < Score4 && Score3 < Score5)

		return Score3;

		else if (Score4 < Score2 && Score4 < Score3 && Score4 < Score1 && Score4 < Score5)

		return Score4;

		else

		return Score5; 

}


# data[].attributes.headline
Faiznur Rahayu Binti Maarupuddin B011210155 LT1Q1

# data[].attributes.subject
Faiznur Rahayu Binti Maarupuddin B011210155 LT1Q1

# data[].attributes.attachment_link.readable_text

//Faiznur Rahayu Binti Maarupuddin
//B 011210155
//Lab Test Question 1

#include <iostream>
#include <iomanip>
using namespace std;

int main()


{
    float interestRate;
    double initialBalance, accountBalance, monthlyDeposit, totalDeposit = 0, monthlyWithdrawn, totalWithdrawn = 0,
           monthlyInterestEarned, totalInterestEarned = 0;
    int months, counter;


    do 
    {
        cout << "What is your annual interest rate? ";
        cin >> interestRate;
        if (interestRate < 0)
            cout << "You cannot enter negative number.\n\n";
    }   while(interestRate < 0);


    do 
    {
        cout << "What is your starting balance? ";
        cin >> initialBalance;
        if (initialBalance < 0)
            cout << "You cannot enter negative number.\n\n";
    }   while(initialBalance < 0);
		accountBalance = initialBalance;


    do 
    {
        cout << "How many months have passed since the account was establish? ";
        cin >> months;
        if (months < 0)
            cout << "Months cannot be negative number.\n\n";
    }   while(months < 0);

    cout << endl;

   
    for (counter = 1; counter <= months; counter++)
    {
        cout << "Please enter the following info for month " << counter << ": " << endl;


        do 
        {
            cout << "How much money was deposited? ";
            cin >> monthlyDeposit;
            if (monthlyDeposit < 0)
            cout << "You cannot enter negative number.\n\n";

        }   while (monthlyDeposit < 0);
			accountBalance += monthlyDeposit;


        do 
        {
            cout << "How much money has been withdrawn from your account? ";
            cin >> monthlyWithdrawn;
            if (monthlyWithdrawn < 0)
            cout << "You cannot enter negative number.\n\n";

        }   while (monthlyWithdrawn < 0);
			accountBalance -= monthlyWithdrawn;

       
        monthlyInterestEarned = accountBalance*(interestRate/12);
        accountBalance += monthlyInterestEarned;

        totalDeposit += monthlyDeposit;
        totalWithdrawn += monthlyWithdrawn;
        totalInterestEarned += monthlyInterestEarned;

        cout<< endl;

    }

  
    cout << fixed << setprecision (2);
    cout << "Ending balance: " << accountBalance << endl << "Total deposit: " << totalDeposit << endl
         << "Total withdrawn: " << totalWithdrawn << endl << "Total interest earned: " << totalInterestEarned << endl;

    return 0;

}


# data[].attributes.body
Dear FKE Students,

Lab Test will be scheduled as follows:

Date: Thursday, 3rd Nov 2016
Time: 08.00 - 10.00
Venue:  Makmal Pengaturcaraan 4 FTMK - Third Floor.

Please be kindly informed.

If you have any questions, you can contact me
through this number +60 16 640 6954.

Thank you.

# data[].attributes.body
B011610126
EXERSICE PAGE 55 NO 3

# data[].attributes.body
B011610126
EXERSICE PAGE 67 NO 3

# data[].attributes.body
DHARRSHEN A/L SANMUGAM
B011610062

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int main()

{	
int Floors=0, TotalRooms=0, TotalOccupied=0, Rooms, Occupied;
	
while(Floors<5)
{
	cout << "How many floors the hotel has? ";
	cin >> Floors;

if (Floors<5) 
    cout << "At least 6 floors are required." << endl; 
    Floors--;
}

for (int i=0; i<Floors; i++)
{
	Rooms=0; 
    while (Rooms<8)
{
if (i<10)
    cout << "How many rooms on floor " << i+1 << "? ";
else
    cout << "How many rooms on floor " << i+2 << "? ";
    cin >> Rooms;
if (Rooms<8) 
    cout << "At least 8 rooms are required." << endl; 
}
TotalRooms+=Rooms;

do
{
	cout << "How many of the rooms are occupied? ";
	cin >> Occupied; 
if (Occupied>Rooms) 
    cout << "The number of occupied rooms can't be greater than the number of rooms on the floor." << endl; 
}
while (Occupied>Rooms); 
TotalOccupied+=Occupied; 
}
    cout << "Total rooms: " << TotalRooms << endl; 
    cout << "Total occupied rooms: " << TotalOccupied << endl; 
    cout << "Total unoccupied rooms: " << TotalRooms-TotalOccupied << endl;
    cout << "Percentage occupancy: " << 100.0*TotalOccupied/TotalRooms; 
return 0; 
}


# data[].attributes.body
DHARRSHEN A/L SANMUGAM
B011610062

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int main ()   
{
   float discount,amount,finalAmount;
   int quantity;
   cout<<"Enter the quantity for your order : ";
   cin>>quantity;
   
   if(quantity<0)
   {
   cout<<"ERROR! NEGATIVE VALUE IS NOT ACCECPTABLE. PLEASE TRY AGAIN \n"; }
   
   else if (quantity>=1 && quantity<10)
   {
   amount= 20*quantity;
   discount=amount*0.0;
   finalAmount =amount-discount;
   cout<<"The cost of the purchase \t  : RM "<<finalAmount<< ".\n"; }
  
   
   else if (quantity>=10 && quantity<=19)
   {
   amount= 20*quantity;
   discount=amount*0.2;
   finalAmount =amount-discount;
   cout<<"The cost of the purchase \t  : RM "<<finalAmount<< ".\n"; }

   else if  (quantity<=49)
   {amount =20*quantity;
   discount=amount*0.3;
   finalAmount=amount-discount;
   cout<<"The cost of the purchase \t  : RM "<<finalAmount<<endl; }
   
   else if ( quantity<=99)
   {amount =20*quantity;
   discount=amount*0.4;
   finalAmount=amount-discount;
   cout<<"The cost of the purchase \t  : RM "<<finalAmount<<endl; }
   
   else if (quantity>=100)
   { amount =20*quantity;
   discount=amount*0.5;
   finalAmount=amount-discount;
   cout<<"The cost of the purchase \t  : RM "<<finalAmount<<endl; }

   
   return 0;
}


# data[].attributes.body
DHARRSHEN A/L SANMUGAM
B0116100

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <string>
using namespace std;
int main()
{
	int hour;
	float price;
	char code;
	cout<< "\n\t\tParking Rate Calculator\n";
	cout << "\n\tHi, \n";
		cout<< "\n\tEnter The Type Of Vehicle   : (C:CAR), (L:LORRY), (B:BUS)";
	cin>> code;
	
	if ((code=='C')||(code=='c'))
	
	{
	
		cout<< "\tEnter The Parking Duration  : " ;
		cin>> hour;
	
	
		if (hour<=3)
		{ price=hour*1.00;
		}
	
		else 
		{
		price=(-(3-hour)*1.50)+3.00;
		}
		
	}
	
		else if	((code=='L')||(code=='l'))
	
	{
		cout<< "\tEnter The Parking Duration  : " ;
		cin>> hour;
	{
		if (hour<=3)
		{ price=hour*1.50;
		}
	
		else 
		{ price=(-(3-hour)*2.50)+4.50;
		}
	}
	
	}
		else if	((code=='B')||(code=='b'))
	
	{
		cout<< "\tEnter The Parking Duration  : " ;
		cin>> hour;
	{
		if (hour<=3)
		{ price=hour*2.00;
		}
	
		else 
		{ price=(-(3-hour)*3.50)+6.00;
		}
	}
	
	}
	
	cout << " \tTotal Payment (RM)	    : "<<price<<"\n\n";
	cout << " \tThank You. Please Come again.\n\n\n\n";
	
}
	


	

# data[].attributes.headline
MUHAMMAD NAIEM BIN MAT NASIR B011410078 4BEKP

# data[].attributes.subject
MUHAMMAD NAIEM BIN MAT NASIR B011410078 4BEKP

# data[].attributes.headline
MUHAMAD FIQRY BIN KHAMIS B011410041 4BEKP

# data[].attributes.subject
MUHAMAD FIQRY BIN KHAMIS B011410041 4BEKP

# data[].attributes.body
lab test question 1
LIM JIA HUEY
B011610048

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include<iomanip>
using namespace std;

int main()
{
	int number_of_months , i ;
	float annual_interest_rate , starting_balance ,monthly_interest_rate ;
    float amount_deposited , amount_withdrawn , total_amount_of_deposit , total_amount_of_withdrawn , monthly_deposit , monthly_withdrawn , monthly_interest_earned ;
    float total_interest_earned , ending_balance , balance ;
    
   	{
		cout<<"The annual interest rate : "<<endl;
    	cin>>annual_interest_rate;
    	if(annual_interest_rate<0)
    	   cout<<"It should be a positive number. "<<endl;
    }	   while(annual_interest_rate<0);
    
    {
    	cout<<"The starting balance : "<<endl;
    	cin>>starting_balance;
    	if(starting_balance<0)
    	   cout<<"It should be a positive number. "<<endl;
    }	   while(starting_balance<0);
    {
    	cout<<"Number of month that have been passed since the account was established : "<<endl;
    	cin>>number_of_months;
    	if(number_of_months<0)
    	   cout<<"Months should be a positive number. "<<endl;
    }	   while(number_of_months<0);
    cout<<endl;
    
    for(i=1;i<=number_of_months;i++)
    {   cout<<"The following info for month "<<i<<" : "<<endl;
       {
	    cout<<"Money was deposited : "<<endl;
        cin>>amount_deposited;
        if(amount_deposited<0)
        cout<<"It should be a positive number. "<<endl;
	   }while(amount_deposited<0);
	    balance = starting_balance + amount_deposited;
	   
	   {
	   	cout<<"Money was withdrawn : "<<endl;
	   	cin>>amount_withdrawn;
	   	if(amount_withdrawn<0)
	   	cout<<"It should be a positive number. "<<endl;
	   }while(amount_withdrawn<0);
	   balance = balance - amount_withdrawn ;
	   
	   monthly_interest_earned = balance*(annual_interest_rate / 12);
	   balance = balance + monthly_interest_earned ;
	   total_amount_of_deposit = total_amount_of_deposit + monthly_deposit ;
	   total_amount_of_withdrawn = total_amount_of_withdrawn + monthly_withdrawn ;
	   total_interest_earned = total_interest_earned + monthly_interest_earned ;
	   cout<<endl;
	}
	
	   cout<<setprecision(2);
	   cout<<"Ending balance : "<<balance<<endl;
	   cout<<"Total deposit : "<<total_amount_of_deposit<<endl;
	   cout<<"Total withdrawn : "<<total_amount_of_withdrawn<<endl;
	   cout<<"Total interest earned : "<<total_interest_earned<<endl;
	   
   return 0;
   
}
    	

# data[].attributes.body
NURUL FATIN FATIHAH BT MOHAMAD SHABANA
B011610096
EXERCISE 3 PAGE 67

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

int main ()
{
	float total_room,room,unoccupied_room,percentage,i,room_occupied,floors,total_room_occupied;
	cout<<"how many floors the hotel has ";
	cin>>floors;
	
	for(i=1; i<=floors; i++)

	{
		cout<<"how many rooms for floor "<<i<<endl;
		cin>>room;
		
		cout<<"how many room are occupied\n";
		cin>>room_occupied;
		
		total_room=total_room+room;
		total_room_occupied= total_room_occupied+room_occupied;
		unoccupied_room=(total_room-total_room_occupied);
		
		
	}
	percentage=(total_room_occupied/total_room)*100;
	
	cout<<"total of rooms:"<<total_room<<endl<<endl;
    cout<<"total of room occupied:"<<total_room_occupied<<endl<<endl;
    cout<<"total of unoccupied room:"<<unoccupied_room<<endl<<endl;
    cout<<"percentage:"<<percentage<<endl<<endl;
     
     return 0;
}


# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

int main ()
{
	float total_room,room,unoccupied_room,percentage,i,room_occupied,floors,total_room_occupied;
	cout<<"how many floors the hotel has ";
	cin>>floors;
	
	for(i=1; i<=floors; i++)

	{
		cout<<"how many rooms for floor "<<i<<endl;
		cin>>room;
		
		cout<<"how many room are occupied\n";
		cin>>room_occupied;
		
		total_room=total_room+room;
		total_room_occupied= total_room_occupied+room_occupied;
		unoccupied_room=(total_room-total_room_occupied);
		
		
	}
	percentage=(total_room_occupied/total_room)*100;
	
	cout<<"total of rooms:"<<total_room<<endl<<endl;
    cout<<"total of room occupied:"<<total_room_occupied<<endl<<endl;
    cout<<"total of unoccupied room:"<<unoccupied_room<<endl<<endl;
    cout<<"percentage:"<<percentage<<endl<<endl;
     
     return 0;
}


# data[].attributes.body
NURUL FATIN FATIHAH BT MOHAMAD SHABANA
B011610096
EXERCISE 3 PAGE 55

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

int main()
{
	float eyes_distance, nose_chin_distance, ratio1,ratio2,ratio3,diff12,diff13,diff23;
	
	cout<< "enter value in cm"<<endl<<endl;
	cout<< "enter eyes distance and nose to chin distance for image 1:";
	cin>>eyes_distance>> nose_chin_distance;
	ratio1= eyes_distance/ nose_chin_distance;
	
	cout<< "enter eyes distance and nose to chin distance for image 2:";
	cin>> eyes_distance>> nose_chin_distance;
	ratio2= eyes_distance/ nose_chin_distance;
	
	cout<< "enter eyes distance and nose to chin distance for image 3:";
	cin>> eyes_distance>> nose_chin_distance;
	ratio3= eyes_distance/ nose_chin_distance;
	
	diff12= (ratio1-ratio2);
	diff13= (ratio1-ratio3);
	diff23= (ratio2-ratio3);
	
	if ((diff12<= diff13) && (diff12<= diff23)) 
	{
		cout<<" best matches is between image 1 and image 2";
	}
	
	if((diff13<= diff12) && (diff13<= diff23))
	{
		cout<<" best matches is between image 1 and image 3";
	}
	
	if ((diff23<= diff12) && (diff23<= diff13))
	{
		cout<<" best matches is between image 2 and image 3";
	}
	return 0;
	
}

# data[].attributes.headline
B011610090 FATINA FARZANA BINTI BAHARIN BEKG S1 LAB ASSESMENT 1 PAGE 67 EXERCISE 3 -HOTEL OCCUPATION

# data[].attributes.subject
B011610090 FATINA FARZANA BINTI BAHARIN BEKG S1 LAB ASSESMENT 1 PAGE 67 EXERCISE 3 -HOTEL OCCUPATION

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

int main()
{
	double floors=0, count=0, rooms, rooms_total=0, occupied, occupied_total=0, unoccupied, number=0, percentage=0;

	cout << "Welcome To Farz Hotel \n";
	cout << "How many floors in your hotel ?\n";
	cin >> floors;

		while (floors < 1)
		{
			cout << "ERROR !! The number of floors cannot be less than 1 \n";
			cout << "PLEASE TRY AGAIN.\n";
			cin >> floors;
		}
		while (number < floors)
		{
			count++;

			cout <<"How many rooms are there on floor number " << count << " ? \n";
			cin >> rooms;
			
			cout <<"How many rooms are occupied on floor number " << count <<  " ?\n";
			cin >> occupied;
			while (occupied > rooms)
			{		
				cout <<"ERROR: You cannot have more occupied rooms than total rooms on floor! Please try again.\n";
				cin >> occupied;
			}
	
			number++;
		
			rooms_total+=rooms;
			occupied_total+=occupied;
		}

	unoccupied = rooms_total - occupied_total;
	percentage = occupied_total / rooms_total *100;

	cout <<"\n\tTotal Floors: " << floors << endl;
	cout <<"\tTotal Rooms: " << rooms_total << endl;
	cout <<"\tTotal Occupied rooms: " << occupied_total << endl;
	cout <<"\tTotal Unoccupied room: " << unoccupied << endl;
	cout <<"\tThe Percentage of the occupied rooms is " << percentage << "%.\n\n";

	cout <<"Thank You.\n\n\n\n";

	return 0;
}

# data[].attributes.headline
B011610090 FATINA FARZANA BINTI BAHARIN BEKG S1 LAB ASSESMENT 1 PAGE 55 EXERCISE 3 - FACE IMAGE RECOGNITION

# data[].attributes.subject
B011610090 FATINA FARZANA BINTI BAHARIN BEKG S1 LAB ASSESMENT 1 PAGE 55 EXERCISE 3 - FACE IMAGE RECOGNITION

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;

int main() 
{
	double image1A, image1B, image2A, image2B, image3A, image3B;
	double difference1, difference2, difference3;
	double Fdifference1, Fdifference2, Fdifference3;
	
	cout << "Enter values in cm.\n";
	cout << "\nEnter eye distance and nose to chin distance for image 1 : \n";
		cout << " Eye Distance: ";
		cin >> image1A ;
		cout << " Nose To Chin Distance: ";
		cin >> image1B;
	
	cout << "\nEnter eye distance and nose to chin distance for image 2 : \n";
		cout << " Eye Distance: ";
		cin >> image2A ;
		cout << " Nose To Chin Distance: ";
		cin >> image2B ;
	
	cout << "\nEnter eye distance and nose to chin distance for image 3 : \n";
		cout << " Eye Distance: ";
		cin >> image3A ;
		cout << " Nose To Chin Distance: ";
		cin >> image3B;
		
	difference1 = image1A - image1B;
	difference2 = image2A - image2B;
	difference3 = image3A - image3B;
	
	Fdifference1 = difference1 - difference2;
	Fdifference2 = difference1 - difference3;
	Fdifference3 = difference2 - difference3;

	if (Fdifference1 < 0)
	{
		Fdifference1 = Fdifference1*-1;
	}
	
	if (Fdifference2 < 0)
	{
		Fdifference2 = Fdifference2*-1;
	}

	if (Fdifference3 < 0)
	{
		Fdifference3 = Fdifference3*-1;
	}

	
	if (Fdifference1 < Fdifference2 && Fdifference1 < Fdifference3)
	{
		cout << "Best matches is between image 1 and image 2 \n\n";
	}
	else if (Fdifference2 < Fdifference1 && Fdifference2 < Fdifference3)
	{
		cout << "Best matches is between image 1 and image 3 \n\n";
	}
	else if (Fdifference3 < Fdifference1 && Fdifference3 < Fdifference2)
	{
		cout << "Best matches is between image 2 and image 3\n\n";

	}else
	{
		cout << "\nAll images have the same matches !!";
	}
	return 0;

}

# data[].attributes.body
Saving Accaunt Balance
MUHAMAD HAFIZUL BIN SANI
B011410087
4 BEKP SECTION 2
LT1Q1

# data[].attributes.attachment_link.readable_text


/**MUHAMAD HAFIZUL BIN SANI**/
/**B011410087**/
/**4 BEKP SECTION 2**/
/** LT1Q1**/

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    float   interestRate;
    double  initialBalance,         accountBalance,
            monthlyDeposit,         totalDeposit = 0,
            monthlyWithdrawn,       totalWithdrawn = 0,
            monthlyInterestEarned,  totalInterestEarned = 0;
    int     months, counter;

    do 
    {
        cout << "What is the annual interest rate? ";
        cin >> interestRate;
        if (interestRate < 0)
            cout << "It should be a positive number.\n\n";
    }   while(interestRate < 0);

    do 
    {
        cout << "What is the starting balance? ";
        cin >> initialBalance;
        if (initialBalance < 0)
            cout << "It should be a positive number.\n\n";
    }   while(initialBalance < 0);
    accountBalance = initialBalance;

    do 
    {
        cout << "How many months have passed since the account was established? ";
        cin >> months;
        if (months < 0)
            cout << "Months should be a positive number.\n\n";
    }   while(months < 0);

    cout << endl;

    for (counter = 1; counter <= months; counter++)
    {
        cout << "Please enter the following info for month " << counter << ": " << endl;

        do 
        {
            cout << "How much money was deposited? ";
            cin >> monthlyDeposit;
            if (monthlyDeposit < 0)
            cout << "It should be a positive number.\n\n";

        }   while (monthlyDeposit < 0);
        accountBalance += monthlyDeposit;


        do
        {
            cout << "How much money was withdrawn from account? ";
            cin >> monthlyWithdrawn;
            if (monthlyWithdrawn < 0)
            cout << "It should be a positive number.\n\n";

        }   while (monthlyWithdrawn < 0);
        accountBalance -= monthlyWithdrawn;

        monthlyInterestEarned = accountBalance*(interestRate/12);
        accountBalance += monthlyInterestEarned;

        totalDeposit += monthlyDeposit;
        totalWithdrawn += monthlyWithdrawn;
        totalInterestEarned += monthlyInterestEarned;

        cout << endl;
    }

    cout    << fixed << setprecision (2);
    cout    << "Ending balance: " << accountBalance << endl
            << "Total deposit: " << totalDeposit << endl
            << "Total withdrawn: " << totalWithdrawn << endl
            << "Total interest earned: " << totalInterestEarned << endl;

    return 0;
}







# data[].attributes.body
IRA NATRIATUL SHIZZA BT SUHARDI
B01610126

# data[].attributes.body
nurul izian syamimi binti suhaimi
b0116100

# data[].attributes.attachment_link.readable_text
#include<iostream>
using namespace std;
int main()
{
	double annual_interest_rate, starting_balance_number, deposited, months, ending_balance, balance_1, balance_2, amount_withdrawn;
	cout << "Enter the amount deposited for this month";
	cin>> deposited;
	cout << "Enter the starting balance";
	cin >> starting_balance_number;

	if ((deposited <= 0) || (starting_balance_number <= 0))
	{
		cout << "The account are closed\n";

		return 0;
	}
	else

		balance_1 = starting_balance_number + deposited;
	cout << "Your balance account" << balance_1 << endl;

	cout << "Enter the amount withdrawn from the account :";
	cin >> amount_withdrawn;

	if (amount_withdrawn <= 0)

	{
		cout << "The account are closed\n";

		return 0;
	}
	else

		balance_2 = balance_1 - amount_withdrawn;
	cout << "Your balance account" << balance_2 << endl;

	cout << "Enter your annual interest rate";
	cin >> annual_interest_rate;

	{
		months = annual_interest_rate / 12;

	}
	ending_balance = months * balance_2;

	cout << "Your ending balance is :" << ending_balance << endl;
	cout << "Your total amount deposited :" << deposited << endl;
	cout << "Your total amount withdrawn :" << amount_withdrawn << endl;
	cout << "Your total interest :" << months << endl;

	return 0;
}





# data[].attributes.body
nur hamidah binti roslan
b011610034

# data[].attributes.attachment_link.readable_text
#include<iostream>
using namespace std;
int main()
{
	double annual_interest_rate, starting_balance_number, deposited, months, ending_balance, balance_1, balance_2, amount_withdrawn;
	cout << "Enter the amount deposited for this month";
	cin>> deposited;
	cout << "Enter the starting balance";
	cin >> starting_balance_number;

	if ((deposited <= 0) || (starting_balance_number <= 0))
	{
		cout << "The account are closed\n";

		return 0;
	}
	else

		balance_1 = starting_balance_number + deposited;
	cout << "Your balance account" << balance_1 << endl;

	cout << "Enter the amount withdrawn from the account :";
	cin >> amount_withdrawn;

	if (amount_withdrawn <= 0)

	{
		cout << "The account are closed\n";

		return 0;
	}
	else

		balance_2 = balance_1 - amount_withdrawn;
	cout << "Your balance account" << balance_2 << endl;

	cout << "Enter your annual interest rate";
	cin >> annual_interest_rate;

	{
		months = annual_interest_rate / 12;

	}
	ending_balance = months * balance_2;

	cout << "Your ending balance is :" << ending_balance << endl;
	cout << "Your total amount deposited :" << deposited << endl;
	cout << "Your total amount withdrawn :" << amount_withdrawn << endl;
	cout << "Your total interest :" << months << endl;

	return 0;
}





# data[].attributes.body
B011410022
4BEKP

# data[].attributes.body
B011410027
4BEKP

# data[].attributes.body
MOHD AKMAL HAKIM BIN NOR RAHIM
4BEKP/S2

# data[].attributes.body
nurul izian syamimi suhaimi (b011610016)

# data[].attributes.body
NUR ASYIQIN BINTI JAMALUDDIN
B011610102
EXERCISE PG 55

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int main()
{
	float eye_distance, nose_chin_distance,ratio_image1,ratio_image2,ratio_image3,min;
	
	cout<<"Enter values in cm."<<endl<<endl;
	cout<<"Enter eye distance and nose to chin distance for image 1:";
	cin>>eye_distance >>nose_chin_distance;
	
	ratio_image1=eye_distance/nose_chin_distance;
	
	cout<<"Enter eye distance and nose to chin distance for image 2:";
	cin>>eye_distance >>nose_chin_distance;
	
	ratio_image2=eye_distance/nose_chin_distance;
	
	cout<<"Enter eye distance and nose to chin distance for image 3:";
	cin>>eye_distance >>nose_chin_distance;
	
	ratio_image3=eye_distance/nose_chin_distance;
	
	min=ratio_image1;
	if (ratio_image2<min)
	{
		min=ratio_image2;
		
	}
	else if(ratio_image3<min)
	min=ratio_image3;
	
	cout<<endl<<"Best matches is between "<<min;
	
	return 0;
}


# data[].attributes.body
MOHD AKMAL HAKIM BIN NOR RAHIM B011410291
4BEKP/S2

# data[].attributes.body
NURIZZATI HIDAYATULLAH BT BADRUL HISHAM
B011610164
ASSIGNMENT PAGE 55 NO.3

# data[].attributes.attachment_link.readable_text
 #include<iostream>
 # include <cmath>
 using namespace std;
 
 int main()
 
 {       double Eyes1, Eyes2, Eyes3, Nosechin1, Nosechin2, Nosechin3, Ratio1, Ratio2, Ratio3;
 		 float Diff12, Diff13, Diff23;
 		 int Distance;
 		 
 		 cout<<" Enter value in cm "<<endl<<endl;
 		 cout<<" Enter eye distance and nose to chin distance for image 1: "<< Distance << " " ;
 		 cin>> Eyes1 >> Nosechin1;
 		 
 		 Ratio1 = Eyes1/Nosechin1;
 		 
 		 cout<<" Enter eye distande and nose to chindistance for image 2: "<< Distance << " " ;
 		 cin>> Eyes2 >> Nosechin2;
 		 
 		 Ratio2 = Eyes2/Nosechin2;
 		 
 		 cout<<" Enter eye distance and nose to chin distance for image 3: "<< Distance << " " ;
 		 cin>> Eyes3 >> Nosechin3;
 		 
 		 Ratio3 = Eyes3/Nosechin3;
 		 
 		 Diff12 = fabs (Ratio1 - Ratio2);
 		 Diff13 = fabs (Ratio1 - Ratio3);
 		 Diff23 = fabs (Ratio2 - Ratio3);
 		  		 
 		 if ((Diff12 <= Diff13) && (Diff12 <= Diff23))
 		 {
 		 	cout << "Best matches is between image 1 and 2 \n" ;
 		
		 }
		 
		 if ((Diff13 <= Diff12) && (Diff13 <= Diff23))
		 {
		 	cout << "Best matches is between image 1 and 3 \n" ;
		
		 }
		 
		 if ((Diff23 <= Diff13) && (Diff23 <= Diff12))
		 { 
		 	cout << "Best matches is between image 2 and 3 \n" ;
		 	
		 }
		 
		 
		 return 0;
		 

		  
 		 
 }
 

# data[].attributes.headline
B011410024 MUHAMMAD JABIR BIN MOHD ZAINI 4BEKP S2

# data[].attributes.subject
B011410024 MUHAMMAD JABIR BIN MOHD ZAINI 4BEKP S2

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include<iomanip>
#include<cstdlib>

using namespace std;

int main()
{	
	float interestRate;
	double initialBalance, accountBalance, monthlyDeposit, totalDeposit=0, monthlyWithdrawn, totalWithdrawn=0, monthlyInterestEarned, totalInterestEarned=0;
	int months,counter;
	
	do/**ANNUAL INTEREST RATE**/
	{
		cout<<"What is the annual interest rate? ";
		cin>>interestRate;
		if (interestRate<0)
			cout<< "It should be a positive number.\n\n";
	} while(interestRate<0);
	
	do/** STARTING BALANCE & add initial balance to account balance **/
	{
		cout<<"What is the starting balance? ";
		cin>>initialBalance;
		if (initialBalance<0)
			cout<<"It should be a positive number.\n\n";
	} while(initialBalance<0);
	accountBalance = initialBalance;
	
	do/** MONTHS PASSED **/
	{
		cout<< "How many months have passed since the account was established? ";
		cin>> months;
		if (months<0)
			cout<< "Months should be a positive number.\n\n";
	}while(months<0);
	 
	 
	cout<<endl;
	
	/** to run each month **/
	for ( counter = 1; counter <= months; counter++)
	{
		cout<< " Please enter the following info for month " <<counter<<" : "<<endl;
		
		do /** ask for monthly deposit, if wrong, repeat & add to accountBalance **/
		{
			cout<<"How much money was deposited? ";
			cin>>monthlyDeposit;
			if(monthlyDeposit<0)
			cout<<"It should be a positive number.\n\n" ;
			
		} while (monthlyDeposit<0);
		accountBalance -=monthlyWithdrawn;
		
		/** Calculate monthly interest earned & add to account balance **/
		monthlyInterestEarned = accountBalance*(interestRate/12);
		accountBalance += monthlyInterestEarned;
		
		/** Calculate for total amount of deposit, withdrawal & interest earned **/
		totalDeposit += monthlyDeposit;
		totalWithdrawn += monthlyWithdrawn;
		totalInterestEarned += monthlyInterestEarned;
		
		cout<<endl;
	}
	
	/** Display result message **/
	cout << fixed<<setprecision (2);
	cout	<<"Ending Balance: "<<accountBalance<<endl;
			<<"total deposit: "<<totalDeposit<<endl;
			<<"total withdrawn: "<<totalWithdrawn<<endl;
			<<"total interest earned: "<<totalInterestEarned<<endl;
			
	return 0;
}
	

# data[].attributes.body
NUR ASYIQIN BINTI JAMALUDDIN
B011610102
EXERCISE PGH

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int main ()
 
 {
 	float totalroom, room, unoccupiedroom, percentage, i, room_occupied, floor, totalroomoccupied;
	  cout<<" How Many Floor The Hotel Has :";
	  cin>>floor;
	  
	  for(i=1;i<=floor;i++)
	  
	  {
	  	
	  	
	  	 cout<<"How Many Room For Floor :"<<i<<endl;
	  	 cin>>room;
	  	 
	  	 
	  	 cout<<"How Many Room Are Occupied :"<<endl;
	  	 cin>>room_occupied;
	  	 
	  	 totalroom=totalroom+room;
	  	 totalroomoccupied-totalroomoccupied+totalroomoccupied;
	  	 unoccupiedroom=(totalroom-totalroomoccupied);
	  	 
	  	 
	  }
	  
	  percentage=(totalroomoccupied/totalroom)*100;
	  
	  cout<<"total off room:"<<totalroom<<endl;
	  cout<<"total of room occupied:"<<totalroomoccupied<<endl;
	  cout<<"total of room unoccupied:"<<unoccupiedroom<<endl;
	  cout<<"percentage:"<<percentage<<endl;
	  
	  return 0;
	  
 }

# data[].attributes.attachment_link.readable_text
//Bakeel Mohammed Almqdashi
//B011610243
#include <iostream>
#include <iomanip>
using namespace std;

void getScore(int &score);
int findLowest(int, int, int, int, int);
void calcAverage(int, int, int, int, int, int);


int main ()
{
int score1, score2, score3, score4, score5, lowest;




getScore(score1);
getScore(score2);
getScore(score3);
getScore(score4);
getScore(score5);


findLowest(score1, score2, score3, score4, score5);

calcAverage(score1, score2, score3, score4, score5, lowest);


system("pause");
return 0;
}



void getScore(int &score)
{

cout << "Please enter test score (Please enter value between 1 and 100): ";
cin >> score;


while (score < 1 || score > 100)
{
cout << "ERROR: Please enter Test score values 0 to 100! ";
cin >> score;
}
}

int findLowest(int score1, int score2, int score3, int score4, int score5)
{
int lowest = score1;

{
if (score2 < lowest)
lowest = score2;
else if (score3 < lowest)
lowest = score3;
else if (score4 < lowest)
lowest = score4;
else if (score5 < lowest)
lowest = score5;
}

cout << "The lowest test score is " << lowest << endl;

return lowest;
}

void calcAverage (int score1, int score2, int score3, int score4, int score5, int lowest)

{	double average;

average = (((float)score1 + score2 + score3 + score4 + score5) - lowest) / 4.0;
cout << setw(4);
cout << fixed << showpoint << setprecision(2);
cout << "The average of the 4 highest test scores entered is: " << average << endl;

}

# data[].attributes.headline
B011410024 MUHAMMAD JABIR BIN MOHD ZAINI 4BEKP S2

# data[].attributes.subject
B011410024 MUHAMMAD JABIR BIN MOHD ZAINI 4BEKP S2

# data[].attributes.body
KAMARUL SHAZRY BIN KAMALUDIN(B011610268)

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<iomanip>
using namespace std;

void getScore(int);
void calcAverage(int, int, int, int, int, int);
int findLowest(int, int, int, int, int);

int main(){

	int score1, score2, score3, score4, score5, lowest;

	getScore(score1);
	getScore(score2);
	getScore(score3);
	getScore(score4);
	getScore(score5);

	findLowest(score1, score2, score3, score4, score5);

	calcAverage(score1, score2, score3, score4, score5, lowest);

	system("pause");
	return 0;
}

void getScore(int &score){

	cout << "Please enter a score between 0 - 100: ";
	cin >> score;

	while (score < 0 || score > 100){
		cout << "Error - enter a score between 0 - 100: ";
		cin >> score;
	}
}

int findLowest(int score1, int score2, int score3, int score4, int score5, int lowest){
	int lowest = score1;

	if (score2 < lowest)
		lowest = score2;
	else if (score3 < lowest)
		lowest = score3;
	else if (score4 < lowest)
		lowest = score4;
	else if (score5 < lowest)
		lowest = score5;

	cout << "The lowest score is " << lowest << endl;
	return lowest;
}

void calcAverage(int score1, int score2, int score3, int score4, int score5){
	int findLowest(int, int, int, int, int, int);
	int lowest;
	double average;

	findLowest(score1, score2, score3, score4, score5, lowest);

	average = (((float)score1 + score2 + score3 + score4 + score5) - lowest) / 4.0;

	cout << setw(4);
	cout << fixed << showpoint << setprecision(2);
	cout << "The average of the 4 highest scores is " << average << endl;
}

# data[].attributes.headline
MUHAMAD FIQRY BIN KHAMIS B011410041 4BEKP TEST1

# data[].attributes.subject
MUHAMAD FIQRY BIN KHAMIS B011410041 4BEKP TEST1

# data[].attributes.body
norizati binti mohd nawi
b011610109

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <cstdlib>
#include<iomanip>
using namespace std;

int main()

{ 
    double annualInterestRate = 0;
    double startingBalance = 0;
    int numberOfMonthsPassed = 0;
    double deposits = 0;
    double withdrawal = 0;
    double totalDeposits = 0;
    double totalWithdrawal = 0;
    double totalInterest = 0;
    double monthlyInterestRate = 0;
    double totalBalance = 0;
    
    cout<< "enter the annual interest rate";
    cin >> annualInterestRate;
    

	cout<< "enter the starting balance";
	cin >>startingBalance;
	
	cout<< "enter the number of months passed";
	cin >> numberOfMonthsPassed;
	
	totalBalance = startingBalance;
	monthlyInterestRate = annualInterestRate/12;
	
	for(int x=1; x<= numberOfMonthsPassed; ++x)
	{
		cout<< "nMonths #"<<x<<endl;
		
		cout<< "tTotal deposits for this month: $";
		cin >> deposits;
		totalDeposits += deposits;
		totalBalance += deposits;
		
		cout<< "tTotal withdrawal for this month: $";
		cin >> withdrawal;
		totalWithdrawal += withdrawal;
		totalBalance += withdrawal;
		
		totalInterest += (totalBalance*monthlyInterestRate);
		totalBalance += (totalBalance*monthlyInterestRate);
		
		if(deposits < 0 || withdrawal < 0 || totalBalance < 0)
		{
			cout<< "nPlease enter positive number only!";
			cout<< "nThe account has been closed..n";
			exit(1);
			
		}
	}
	
	//display results
	cout<<fixed<<setprecision(2);
	cout.fill('.');
	cout<< "nEnding balance:"<<left<<setw(20)<<right<<setw(20)<< "$"<<totalbBalance;
	cout<< "nAmount of deposits:"<<left<<setw(20)<<right<<setw(16)<< "$"<<totalDeposits;
	cout<< "nAmount of withdrawal:"<<left<<setw(20)<<right<<setw(13)<< "$"<<totalWithdrawal;
	cout<< "nAmaount of interest earned:"<<left<<setw(0)<<right<<setw(9)<< "$"<<totalInterest<<endl;
	return 0;
}

# data[].attributes.body
muhammad fitri bin md yusuf
b011410027 4 bekp

# data[].attributes.body
NUR NISHA ATIQAH BINTI ABD. JALAL B011410025
4BEKP/S2

# data[].attributes.body
NURIZZATI HIDAYATULLAH BT BADRUL HISHAM
B011610164
TEST 1

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	float interest_rate,starting_balance,number_month_passed,deposited_month,withdrawn_month,monthly_interest;
    float account_balance,initial_balance
	int month,counter;


	
	{  
	     cout<<"The annual interest rate";
	     cin>>interest_rate;
	     if (interest_rate < 0)
	         cout<<"It should be a positive number"<<endl<<endl;
	     while(interest_rate < 0); 
	
	
	     cout<<"What a starting balance";
	     cin>>starting_balance;
	     if (starting_balance < 0);
		     cout<<"It should be a postive number"<<endl<<endl;
	     while(starting_balance < 0)
	     account_balance = initial_balance;
    
	        
		 cout<<"How many months have passed since the account was established?";
		 cin>>month;
		 if (months < 0)
		     cout<<"Month should be a positive number"<<endl<<endl;
		 while(month < 0);
    }
		 cout<<endl;/
		 
	for (i=1;i<= month;i++)
	{
		cout<<"PLEASE ENTER THE FOLLOWING INFO"<<i<<endl;
		
		{
			cout<<"How much deposited?";
			cin>>deposited_month
			if(deposited_month < 0)
				cout<<"It should be a positive number"<<endl<<endl;
			while (deposited_month < 0)
			account_balance= deposited_month ;
		}
		
		{
			cout<<"How much money was withdrawn from account? " ;
			cin>>withdrawn_month;
			if (withdrawn_month < 0 );
				cout << "It should be a positive number"<<endl<<endl;
			while (withdrawn_month < 0);
			account_balance = withdrawn_month;
			
			return 0;
			
		}
	}
		 
		     
	     
	
}

# data[].attributes.headline
B011410023 MUHAMMAD AZRI BIN JAMALUDDIN 4BEKP S2

# data[].attributes.subject
B011410023 MUHAMMAD AZRI BIN JAMALUDDIN 4BEKP S2

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include<iomanip>
#include<cstdlib>

using namespace std;

int main()
{	
	float interestRate;
	double initialBalance, accountBalance, monthlyDeposit, totalDeposit=0, monthlyWithdrawn, totalWithdrawn=0, monthlyInterestEarned, totalInterestEarned=0;
	int months,counter;
	
	do/**ANNUAL INTEREST RATE**/
	{
		cout<<"What is the annual interest rate? ";
		cin>>interestRate;
		if (interestRate<0)
			cout<< "It should be a positive number.\n\n";
	} while(interestRate<0);
	
	do/** STARTING BALANCE & add initial balance to account balance **/
	{
		cout<<"What is the starting balance? ";
		cin>>initialBalance;
		if (initialBalance<0)
			cout<<"It should be a positive number.\n\n";
	} while(initialBalance<0);
	accountBalance = initialBalance;
	
	do/** MONTHS PASSED **/
	{
		cout<< "How many months have passed since the account was established? ";
		cin>> months;
		if (months<0)
			cout<< "Months should be a positive number.\n\n";
	}while(months<0);
	 
	 
	cout<<endl;
	
	/** to run each month **/
	for ( counter = 1; counter <= months; counter++)
	{
		cout<< " Please enter the following info for month " <<counter<<" : "<<endl;
		
		do /** ask for monthly deposit, if wrong, repeat & add to accountBalance **/
		{
			cout<<"How much money was deposited? ";
			cin>>monthlyDeposit;
			if(monthlyDeposit<0)
			cout<<"It should be a positive number.\n\n" ;
			
		} while (monthlyDeposit<0);
		accountBalance -=monthlyWithdrawn;
		
		/** Calculate monthly interest earned & add to account balance **/
		monthlyInterestEarned = accountBalance*(interestRate/12);
		accountBalance += monthlyInterestEarned;
		
		/** Calculate for total amount of deposit, withdrawal & interest earned **/
		totalDeposit += monthlyDeposit;
		totalWithdrawn += monthlyWithdrawn;
		totalInterestEarned += monthlyInterestEarned;
		
		cout<<endl;
	}
	
	/** Display result message **/
	cout << fixed<<setprecision (2);
	cout	<<"Ending Balance: "<<accountBalance<<endl;
			<<"total deposit: "<<totalDeposit<<endl;
			<<"total withdrawn: "<<totalWithdrawn<<endl;
			<<"total interest earned: "<<totalInterestEarned<<endl;
			
	return 0;
}
	

# data[].attributes.body
LT1Q2

# data[].attributes.attachment_link.readable_text
//Faiznur Rahayu Binti Maarupuddin
//B 011210155
//Lab Test Question 2


#include <iostream>
using namespace std;

	void getScore(int &);
	void calculateAverage(int, int, int, int, int);
	int findLowest(int, int, int, int, int);


int main()

{

	int Score1, Score2, Score3, Score4, Score5;
		cout << "\nThis programmed will calculated the average of five scores.\n";
		cout << "\n";

			getScore(Score1);
			getScore(Score2);
			getScore(Score3);
			getScore(Score4);
			getScore(Score5);

	calculateAverage(Score1, Score2, Score3, Score4, Score5);

		return 0;

}

	void getScore(int & Score)

{
	do
	{
		cout << "Please enter your test score : ";
		cin >> Score;

	if (Score < 0 || Score > 100)


	{

		cout << " \n Invalid test score! \n " << " Your test score must be greater than 0 and less than 100.\n\n";
	
	}

	} while(Score < 0 || Score > 100);

}

		void calculateAverage(int Score1, int Score2, int Score3, int Score4, int Score5)
	{

		int Lowest; 
		double Avg; 

			Lowest = findLowest(Score1, Score2, Score3, Score4, Score5);

		if (Lowest == Score1)
		Avg = (Score2 + Score3 + Score4 + Score5)/4;

		else if(Lowest == Score2)
		Avg = (Score1 + Score3 + Score4 + Score5)/4;

		else if(Lowest == Score3)
		Avg = (Score2 + Score1 + Score4 + Score5)/4;

		else if(Lowest == Score4)
		Avg = (Score2 + Score3 + Score1 + Score5)/4;

		else
		Avg = (Score2 + Score3 + Score4 + Score1)/4;

				cout << "\nThe average of four highest scores is " << Avg << ".\n\n";

	}

		int findLowest(int Score1, int Score2, int Score3, int Score4, int Score5)

	{ 

		if (Score1 < Score2 && Score1 < Score3 && Score1 < Score4 && Score1 < Score5)

		return Score1;

		else if (Score2 < Score1 && Score2 < Score3 && Score2 < Score4 && Score2 < Score5)

		return Score2;

		else if (Score3 < Score2 && Score3 < Score1 && Score3 < Score4 && Score3 < Score5)

		return Score3;

		else if (Score4 < Score2 && Score4 < Score3 && Score4 < Score1 && Score4 < Score5)

		return Score4;

		else

		return Score5; 

}


# data[].attributes.body
nurul fatin fatihah bt mohamad shabana.. b011610096

# data[].attributes.headline
B011610072 SITI RAIHAN BT SUHAIMI BEKG S1

# data[].attributes.subject
B011610072 SITI RAIHAN BT SUHAIMI BEKG S1

# data[].attributes.body
AIMAN-MUHAIMIN BIN  MOHAMAD SAMSANI
B011610103

# data[].attributes.body
LT1Q1

# data[].attributes.body
MUHAMMAD ZAKUAN BIN HAMZAH
B011610197

# data[].attributes.body
DHARRSHEN A/L SANMUGAM
B011610062