# data[].attributes.body
1. write a function to add 10 elements of array num
2. write a function to find the smallest element and index of the smallest element of array num
3. write a function to print all elements of array num
4. write the main function to call all the three functions.

this asg has been submitted to ilearn.

# data[].attributes.body
Watch "C++ Programming Tutorials: 13 Functions - Passing Variables by Value or Reference" on YouTube
https://youtu.be/6U42W0A4ov4

# data[].attributes.body
2017806234 AMIRHAZIM
2017806206 MUHAMMAD BASHER

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

{
    float score ;
    char grade;
    printGrade (grade);
    
    system ("pause");
    
}

float getScore (float score)
{
      cout << "Enter your score : ";
      cin >> score;
      cout << " Your score is : " << score << endl;
      return score;
}

void printGrade (char grade)
{
     float score;
     getScore (score);
     
     if (score>=80 && score<=100)
     cout << "Your Grade is : 'A' " << endl;
     
     else if (score>=60 && score<=79)
     cout << "Your Grade is : 'B' " << endl;
     
     else if (score>=50 && score<=59)
     cout << "Your Grade is : 'C' " << endl;
     
     else if (score>=40 && score<=49)
     cout << "Your Grade is : 'D' " << endl;
     
      else if (score>=0 && score<=39)
     cout << "Your Grade is : 'F' " << endl;
     
     else
     cout << "INVALID INPUT " << endl;
     
}

# data[].attributes.body
Muhammad bin Mohamad Soufi (2017687226)
Muhammad Syafiq Eizlan bin Taip (2016144111)

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


using namespace std;

float getScore (float x);
char printGrade (float a);
int main()
{
float a,x;
char b;
a=getScore(x);
b=printGrade(a);
cout << "Your grade is " << b << endl;
system ("pause");
return 0;
}


float getScore(float x)
{
float a;
cout <<"Please enter your course score:";
cin >> a;
return a;
}

char printGrade ( float a)
{
char b;
if (a<=100 && a>=80)
b='A';
else if (a<=79 && a>=60)
b='B';
else if (a<=59 && a>=40)
b='C';
else if (a<=39 && a>=20)
b='D';
else if (a<=19 && a>=0)
b='E';
else if (a==0)
b='F';
else
cout << "You dont have grade !!!";
return b;
}

# data[].attributes.headline
Muhammad Firdaus Bin Ahmad Tosim(2017806184), Muhammad Adib bin Mazlan(2017687274)

# data[].attributes.subject
Muhammad Firdaus Bin Ahmad Tosim(2017806184), Muhammad Adib bin Mazlan(2017687274)

# data[].attributes.body
Getscore &Printgrade

# data[].attributes.attachment_link.readable_text
//This program is written by Firdaus & Adib

#include <iostream>
using namespace std;

int getscore (int);
void printgrade (int);

int main()
{
    int score,a;
 
    score= getscore(a);
    printgrade(score);
    
    system("pause");
    return 0;
}
int getscore (int a)
{

    float score;

    cout << "Please input the course score : " ;
    cin >> score;

                        cout<< "\nYour Score for this course is : "<< score << endl;

                       return score;
}
void printgrade (int score)
{
     if(score>=90 && score<=100)
	{
		cout<<"Grade = A+\n\n";
	}
	else if(score>80 && score<=89)
	{
		cout<<"Grade A\n\n";
	}
	else if(score>=59 && score<=79)
	{
		cout<<"Grade B\n\n";
	}
	else if(score>=50 && score<=58)
	{
		cout<<"Grade C\n\n";
	}
	else
	{
        cout<<"Grade = Failed!\n\n";
}
}



# data[].attributes.headline
MUHAMMAD NIZAM B. HAMIDON(2017687236) ,MUHAMMAD TAUFIQ BIN NORZALI(2017806204

# data[].attributes.subject
MUHAMMAD NIZAM B. HAMIDON(2017687236) ,MUHAMMAD TAUFIQ BIN NORZALI(2017806204

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

float getScore(float);
void printGrade(float);

int main()
{
 		float score;
 		
 		score=getScore(score);
 	printGrade(score);	

 system("pause");
}
float getScore(float)
{
 			float score;
 			cout<<"Please enter your score"<<endl;
 			cin>>score;
 			cout<<"your course score is "<<score<<endl;
 			
 			return score;
}
void printGrade(float x)
{
 		
 		 if (x<=100 && x>=90)
 		 cout<< "your grade is A+"<<endl;
 		 if (x<=89 && x>=80)
 		 cout<< "your grade is A"<<endl;
 		  if (x<=79 && x>=75)
 		 cout<< "your grade is A-"<<endl;
 		  if (x<=74 && x>=70)
 		 cout<< "your grade is B+"<<endl;
 		  if (x<=69 && x>=65)
 		 cout<< "your grade is B+"<<endl;
 		  if (x<=64 && x>=60)
 		 cout<< "your grade is B"<<endl;
 		  if (x<=59 && x>=55)
 		 cout<< "your grade is B-"<<endl;
 		  if (x<=54&& x>=50)
 		 cout<< "your grade is C+"<<endl;
 		   else
 		 cout<< "You failed"<<endl;
		 }
 		  

# data[].attributes.body
Muhammad Zulhilmi Bin Alias(2017687268)
Muhamad Rahimi Bin Ramali(2017806192)

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

using namespace std;

float getScore(float);
void printGrade(float&);

int main()
{
    float score,x;
    
    score = getScore(x);
    
    printGrade(score);
    
    system ("pause");
    return 0;
}

float getScore (float x)
{
     float y;
     cout << "Please enter the score for the course :" ;
     cin >> y;
     
     return y;
}
void printGrade(float& score)
{
    char grade;
    if (score >= 80)
    {
              grade= 'A';
    }
    else if (score >= 60)
    {
              grade= 'B';
}
else if (score >= 40)
    {
              grade= 'C';
    }
else if (score >= 20)
    {
              grade= 'D';
    }
else
    {
     grade= 'E';
     }
     
     cout << "The grade for this course is "<< grade <<endl;
     
}

# data[].attributes.body
AFAF NABILA BT FAUZI (2017889482)

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

float getScore();
void printGrade(float);

int main ()
{
    float score;
    score =getScore();
    printGrade(score);
    
    system ("pause");
    return 0;
}
float getScore()
{
      float mark;
      cout << "Enter the mark:";
      cin >> mark;
      cout<< "The course score is:" << mark << endl;
      return mark;
      }
      void printGrade(float y)
      {
           if (y>=100&&y<=80)
           cout << "The course grade is : A"<<endl;
            if ((y>=70)&&(y<80))
           cout << "The course grade is : B"<<endl; 
           if ((y>=60)&&(y<70))
           cout << "The course grade is : C"<<endl; 
           if ((y>=50)&&(y<60))
           cout << "The course grade is : D"<<endl; 
           if (y<60)
           cout << "The course grade is : F"<<endl;
           }
           

# data[].attributes.body
MUHAMAD HAZIQ AKMAL BIN MOHAMED LAILE 2017687216
AHMAD IKMAL BIN MAKHTAR 2017806194

# data[].attributes.attachment_link.readable_text
//MUHAMAD HAZIQ AKMAL BIN MOHAMED LAILE 2017687216
//AHMAD IKMAL BIN MAKHTAR 2017806194

//EXAMPLE 6.7

#include <iostream>

using namespace std;

double getScore (double);
void printGrade(double&);
double score;

int main()
{
	double x;
	score=getScore(x);
	
	printGrade(score);
	
	return 0;
}

double getScore (double x)
{
	double Score;
	
	cout<<"This program is to calculating the grade score";
	cout<<"\nPlease enter your grade score : ";
	cin>>Score;
	
	cout<<"Your course score = "<<Score<<endl;
	
	return Score;	
}

void printGrade(double& score)
{
	char Grade;
	
	if (score>=80 && score<=100)
    {
        Grade = 'A'  ;
    }
    
 	else if (score>=60 && score<=79)
    {
        Grade = 'B'  ;
    }
    
  	else if (score>=40 && score<=59)
    {
        Grade = 'C'  ;
    }
    
  	else if (score>=20 && score<=39)
    {
        Grade = 'D'  ;
    }
    
    else 
    {
        Grade = 'E'  ;
    }
    

    
    cout<<"Your grade is = "<<Grade<<endl;
}

# data[].attributes.body
Mohamad Akmal Bin Mohd Fazli
2017687252
Khalkhalas Bin Kamaludin
2017687278

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<windows.h>

using namespace std;
int getScore();
void printGrade(int);

int main()
{
    int score;
    char grade;
    cout<<"Welcome to Grade Calculator. Let me calculate it for you.\n";
    score=getScore();
    printGrade(score);
}

int getScore()
{
      int a;
      cout<<"Please enter your score for CSC430 test: ";
      cin>> a;
      cout<<"Your score for your CSC430 test are: "<<a<<"%"<<endl;
      return a;
}

void printGrade(int mark)
{
     char grade;
     if (mark>=80 && mark<=100)
        {
                  grade='A';
                  cout<<"Congratulation! You achieve A grade for the test.\n";
        }
        else if (mark>=70 && mark<80)
        {
                  grade='B';
                  cout<<"Good job! You achieve B grade for the test.\n";
        }
        else if (mark>=60 && mark<70)
        {
                  grade='c';
                  cout<<"You achieve C grade for the test.\n";
        }
        else if (mark>=50 && mark<60)
        {
                  grade='D';
                  cout<<"You achieve D grade for the test.\n";
        }
        else
        {
                  grade='F';
                  cout<<"You achieve F grade for the test. Try again next time.\n";
        }
        system("pause");
}
                  

# data[].attributes.body
Muhammad Firdaus binAhmad Tosim(

# data[].attributes.body
Muhamad Aizuddin bin Mohd Zaman (2017806232)
Ahmad Arif bin Sam'on (2017806224)

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

using namespace std;

void getScore(float& mark);
void printGrade(float score);

int main()
{
 	float score;
 	
 	getScore(score);
 	printGrade(score);
 	system ("pause");
}

void getScore(float& mark)
{
 	cout << "Please insert your mark: ";
 	cin >> mark;
 	cout << endl;
 	
 	cout << "Course score is "<< mark << endl;
}

void printGrade(float score)
{
 	char grade;
 	if(score >=80)
 		grade = 'A';
	else if(score >=60)
		grade = 'B';
	else if(score >= 50)
		grade = 'C';
	else
		grade = 'F';
		
 	cout << "Your grade score is "<< grade << endl;
}

# data[].attributes.body
Anis Adilah (2017806196)
Nur Syafiah bt Muhd Ikhwan (2017687228)

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

float getScore();
void printGrade(float);

int main()
{
    float score;
    score = getScore();
    printGrade(score);
    
    system("pause");
    return 0;
}

float getScore()
{
      float markah;
      cout << "Enter the score : ";
      cin >> markah;
      cout << "\nThe course score is " << markah << endl;
      
      return markah;
}

void printGrade(float x)
{
     if (x<50)
     cout << "The course grade is G" << endl;
     if (x>=50&&x<60)
     cout << "The course grade is D" << endl;
     if (x>=60&&x<70)
     cout << "The course grade is C" << endl;
     if (x>=70&&x<80)
     cout << "The course grade is B" << endl;
     if (x>=80&&x<=100)
     cout << "The course grade is A" << endl;
}


# data[].attributes.attachment_link.readable_text

#include <iostream>
using namespace std;
int main()
{
    
    int i, space, rows, k=0;
    cout<<"Enter the number of rows : ";
    cin>>rows;
    for(i=1; i<=rows; i++)
    {
	for(space=1; space<=(rows-i); space++)
	{
	   cout<<"  ";
	}
	while(k!=(2*i-1))
	{
	   cout<<"* ";
	   k++;
	}
	k=0;
	   cout<<"\n";
    }
    system("pause");
		}
    

# data[].attributes.attachment_link.readable_text

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

int main()
{
int n,i,j,k;
cout<<"Enter value of n: ";
cin>> n;
for(i=1; i<=n; i++)
{
         for(j=n; j>=i; j--)
                  {
                        cout<<" ";
                  }
                  for(k=1; k<=(2*i-1); k++)
                  {
                  cout<<"*";
                  }
                  cout<<"\n";
}
system("pause");
   return 0;
}

# data[].attributes.body
Akmal

# data[].attributes.attachment_link.readable_text
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int a,b,c;
for(a=1; a<=3; a++) //  upper triangle 
{
         for(b=2; b>=a; b--)
         {
         cout<<" ";
         }
                 for(c=1; c<=(2*a-1); c++)
                   {
                   cout<<"*";
                   }
cout<<"\n";

}
system("pause");
}

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

int main()
{
  float price, discount;
  cout << "This programe checks whether you can get a discount" << endl;
  cout << "What is the price of the product?" << endl;
  cin >> price;
  if(price>=1000){
   discount = price*0.05;
   price = price - discount;
   cout << "The price after discount is " << price << endl;
  }
  cout << "Thank you";
  system("pause");
  return 0;
}

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

int main(){
    int year;
    float amount, rate, interest, total_loan, mounthly_installment;
    
    cout << "Hello dear customer! Which amount we can offer you?" << endl;
    cin >> amount;
    cout << "Enter the period of repayment in years, please." << endl;
    cin >> year;
    
    if(year >=5 && year<=10){
            rate = 0.067;
            }else if(year >=3 && year<5){
                  rate = 0.055;
                  }else{
                      cout << "The entered period is not valid." << endl;
                      cout << "We can provide you a loan for 3 year." << endl;
                      rate = 0.055;
                      }
    
    interest = rate*amount;
    total_loan = amount + interest;
    mounthly_installment = total_loan/(year*12);
    
    cout << "We can offer you a interest rate of " << rate*100 << " %" << endl;
    cout << "The mentioned interest rate equals " << interest << " RM" << endl;
    cout << "In this case the total loan with interest is " << total_loan << " RM" << endl;
    cout << "The monthly payment is " << mounthly_installment << " RM" << endl;
    system("pause");
    return 0;
}

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

int main(){
    int year;
    float amount, rate, interest, total_loan, mounthly_installment;
    
    cout << "Hello dear customer! Which amount we can offer you?" << endl;
    cin >> amount;
    cout << "Enter the period of repayment in years, please." << endl;
    cin >> year;
    
    if(year >=5){
            rate = 0.045;
            }else{
                  rate = 0.065;
                  }
    
    interest = rate*amount;
    total_loan = amount + interest;
    mounthly_installment = total_loan/(year*12);
    
    cout << "We can offer you a interest rate of " << rate*100 << " %" << endl;
    cout << "The mentioned interest rate equals " << interest << " RM" << endl;
    cout << "In this case the total loan with interest is " << total_loan << " RM" << endl;
    cout << "The monthly payment is " << mounthly_installment << " RM" << endl;
    system("pause");
    return 0;
}

# data[].attributes.body
2014878208

# data[].attributes.attachment_link.readable_text
/*Programmer: Mohd farhan haniff bin mohamed rina (2014878208)
 Class: EMD2M2A
 Date: 03/04/2018
  type a programe based on the following chart. the programme is able to read price from keyboard*/
 

#include<iostream>
#include <iomanip>

using namespace std;
int main()
{
    float price, price_discount, discount;   // Declaration of variables
    cout<<"Hi customer! :D\n";
    cout<<"Please enter the price:RM ";     // Enter the input
    cin>> price;
    
    if (price>=1000)                        // Expression for the selection
    {
       discount=0.05*price;                 // Formula to calculate discount
       price_discount=price-discount;        // Formula to calculate price after discount
       cout<< fixed << setprecision(2) << "The price after discount is RM "<< price_discount << endl; // Display output
    }
    else
    {
        cout<< "Your price is too low to get discount.Sorry.." << endl; // Output when the input entered is wrong.
    }   
    
    cout<<"Thank you for using us." << endl;
    system("pause");
}

# data[].attributes.attachment_link.readable_text
/* 
  Programmer : mohd farhan haniff bin mohamed rina (2014878208)
  Date : 3 April 2018
YDL Nation Bank wants to do some modification to their program so that it can help the customer to calculate the monthly installment by using new condition.  The program however is still able to receive two inputs from the customer, which are the amount of loan in Ringgit Malaysia and year of installment.  Based on these two inputs, the program is able to calculate the monthly installment.  The table for the interest calculation is provided as follows:
 
 | Condition | Interest (%)
 |  5 = Year = 10 | 6.7
 |  3 = Year < 5 | 5.5
 
The formulas for the monthly installment calculation are as follows:
 
            Interest (RM) = Interest (%) x Amount of Loan
            Total Loan with Interest = Amount of Loan + Interest (RM)
            Monthly Installment = Total Loan with Interest / (Year of Installment x 12)   


Save the program as ifelse3.cpp*/

#include <iostream>
using namespace std;

int main ()
{
    float amtloan, year, interest, totalLoan, installment; //declare variable float data type
    
    cout << "welcome to the system"; // Welcoming the customer
    cout << "Please enter the amount of loan (RM): "; // Ask the user to enter amount of loan
    cin >> amtloan; // Read the input and put into amtloan
    cout << "\nPlease enter your number of year of installment : "; //Ask the user to enter number of year of installment
    cin >> year; //Read the input and put into tahun
    
    if(year>=3&&year<=10) // this condition true if number of year of installment is equal or greater than 3 and less than or equal to 10.
    {
       if (year>=3&&year<5) // this condition is true if number of year of installment is equal or greater than 3 and less than 5.
             interest=0.055*amtloan; // interest = 5.5% of the amount of loan
       
       else //this condition is for number of year of installment equal or more than 5 and less than or equal to 10.
             interest=0.067*amtloan; //interest = 6.7% of the amount of loan
         
    totalLoan=amtloan + interest; // Total Loan with Interest = Amount of Loan(RM) + Interest (RM)
    installment = totalLoan/(year*12); //Monthly Installment = Total Loan with Interest / (Year of Installment x 12) 
    
    cout<<"\nYour monthly installment is RM"<<installment<<endl; // Display the Monthly Installment in RM
    }

    else 
        cout << "\n\nERROR!!\n\nThe amount of year should not be less than 3 years or more than 10 years.\n\n"; // Show error message if the year is less than 3 or more than 10 years.
        
    
system ("pause"); // so that this program will not immediately close after run the program.
return 0;
}



# data[].attributes.body
2017806194
ifelse4.cpp

# data[].attributes.attachment_link.readable_text
/* Exercise 7 */
// NAME : AHMAD IKMAL BIN MAKHTAR
// ID NUMBER : 2017806194
// GROUP : EMD2M2A
// DATE : 3/4/2018

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    float price,discount,price_after_discount; //declare all variables using float
    
    cout << "Please enter the price = RM "; //Enter the price input
    cin >> price;
    
    if (price>=1000) //selection of 'if' used for the price
    {
       discount= 0.05*price;
       price_after_discount = price-discount;
       
       cout << "The price after discount is RM " << price_after_discount <<endl;
       cout<< "\nThank You"<<endl;
    }
    else //use for false statement
       cout<< "\nThank You"<<endl;
    
    system ("pause");
    return 0;
}    
       
                    
    

# data[].attributes.body
Muhammad Taufiq (2017806204

# data[].attributes.body
Muhammad Taufiq (2017806204)

# data[].attributes.body
Mohamad Azizul

# data[].attributes.attachment_link.readable_text
/*
Question 5
 

GIVEN FLOW CHART



Save the program as ifelse3.cpp

PROGRAMMER       : Mohamad Azizul Bin Abu Hanifah
STUDENT ID       : 2017687246
DATE             : 3/4/2018
*/



#include <iostream>
using namespace std;
int main ()
{
    float discount, price, tot_price;
   
    
    
    
    cout << "WELCOME TO MOHAMAD SUPERMARKET "<< endl;
    cout << "--------------------------------------------"<< endl;
    cout <<"Please enter the price: RM      ";
    cin >> price;
    
    
    
    
    
    
    
    if (price >=1000)
    {
            
                    discount = price * 5 / 100;
                    tot_price = price-discount;
                    
                    cout << "The price after discount : RM     " << tot_price << endl  ;
                    
    }
    
   
    
                
   else 
   
   {
     cout << "The price after discount : RM     " << price << endl  ;  
        
   } 
   
   
     cout << "Thank you"  << endl  ;             
     
   
    
    
    system ("pause");
    
}

    

# data[].attributes.body
2017806194
ifelse3.cpp

# data[].attributes.attachment_link.readable_text
/*Question 4

YDL Nation Bank wants to do some modification to their program so that it can help the customer to calculate the monthly installment by using new condition.  The program however is still able to receive two inputs from the customer, which are the amount of loan in Ringgit Malaysia and year of installment.  Based on these two inputs, the program is able to calculate the monthly installment.  The table for the interest calculation is provided as follows:
	
Condition       	Interest (%)
 5 <= Year <= 10	6.7
 3 <= Year < 5	    5.5

The formulas for the monthly installment calculation are as follows:

	Interest (RM) = Interest (%) x Amount of Loan
	Total Loan with Interest = Amount of Loan + Interest (RM)
	Monthly Installment = Total Loan with Interest / (Year of Installment x 12)              
*/

// NAME : AHMAD IKMAL BIN MAKHTAR
// ID NUMBER : 2017806194
// GROUP : EMD2M2A
// DATE : 3/4/2018

#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
    int year; // declare variable using integer 'int'
    float amount_loan,interest,total_loan,monthly_installment; // declare variables using float
    
    cout << "Please enter the number of year installment = " ; //Enter the year installment input
    cin >> year;
    
    if (year >=3 && year <=10) //selection of 'if' used for the year
    {
       if ( year >=5 && year <=10)
       {
          interest=0.067 *amount_loan;
       }
         
       else if ( year >=3 && year <5)
       {
         interest =0.055 *amount_loan;
       }
       
       cout<< "Please enter the amount of loan = RM " ; //Enter the amount of loan input
       cin >>amount_loan;
   
       total_loan = amount_loan + interest;
       monthly_installment = total_loan/(year*12);// calculation to calculate monthly installment
    
       cout << "The monthly installment is RM " << monthly_installment <<endl; //display monthly installment output
       
    }   
    else
        {
        cout << "Please reenter number of year!!!!" <<endl; // display this output if year is false
        }   
        
    
    
    system ("pause");
    return 0;
}    
    

# data[].attributes.body
2017687246 MOHAMAD AZIZUL BIN ABU HANIFAH

# data[].attributes.attachment_link.readable_text
/*
Question 4
 
YDL Nation Bank wants to do some modification to their program so that it can help the customer to calculate the monthly installment by using new condition.  The program however is still able to receive two inputs from the customer, which are the amount of loan in Ringgit Malaysia and year of installment.  Based on these two inputs, the program is able to calculate the monthly installment.  The table for the interest calculation is provided as follows:
 
 | Condition | Interest (%)
 |  5 ? Year ? 10 | 6.7
 |  3 ? Year < 5 | 5.5
 
The formulas for the monthly installment calculation are as follows:
 
            Interest (RM) = Interest (%) x Amount of Loan
            Total Loan with Interest = Amount of Loan + Interest (RM)
            Monthly Installment = Total Loan with Interest / (Year of Installment x 12)   

Save the program as ifelse3.cpp

PROGRAMMER       : Mohamad Azizul Bin Abu Hanifah
STUDENT ID       : 2017687246
DATE             : 3/4/2018
*/


#include <iostream>
using namespace std;
int main ()
{
    float loan, tot_loan,mon_ins, interest;
    int year;
    
    
    
    cout << "WELCOME TO YDL NATION BANK CUSTOMER SERVICE "<< endl;
    cout << "--------------------------------------------"<< endl;
    cout <<"Please enter the amount of loan : RM      ";
    cin >> loan;
    
    cout<<  "Enter the year of installment (years) :  ";
    
    cout << endl;
    cin >> year;
    
    
    
    if (year>=5 && year<=10)
    {
                     interest = loan*0.067;
                    tot_loan = loan + interest;
                    mon_ins = tot_loan/(year*12);
                    cout << "The amount of interest is : RM     " << interest<< endl  ;
                    cout << "The payment of loan with interest is : RM     " << tot_loan<< endl ;
                    cout << "The monthly installment is : RM     " << mon_ins  << endl;
    }
    
    
    else if (year>=3 && year<5)
    {
                     interest = loan*0.055;
                    tot_loan = loan + interest;
                    mon_ins = tot_loan/(year*12);
                    cout << "The amount of interest is : RM     " << interest<< endl  ;
                    cout << "The payment of loan with interest is : RM     " << tot_loan<< endl  ;
                    cout << "The monthly installment is : RM     " << mon_ins  << endl;
    }    
    
                
   else 
   
   {
       cout << "The amount of interest is NOT CALCULATED"<< endl;
       cout <<endl;
       cout << "The payment of loan with interest is NOT CALCULATED"<< endl ;
       cout << endl;
       cout << "The monthly installment is NOT CALCULATED"<< endl; 
       cout << endl; 
        
   }                
     
   
    
    
    system ("pause");
    
}

    

# data[].attributes.body
MUHAMMAD SYAFIQ EIZLAN
2016144111

# data[].attributes.body
MUHAMMAD SYAFIQ EIZLAN 2016144111

# data[].attributes.body
MUHAMAD RAHIMI BIN RAMALI
2017806192

# data[].attributes.attachment_link.readable_text
//THIS PROGRAM IS USE TO CALCULATED THE PRICE AFTER DISCOUNT
// CREATED BY MUHAMAD RAHIMI BIN RAMALI
// 2017806192	
// 3 APRIL 2018
//EMD2M2A
//ifelse4

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
 		float price, discount, price_after;//variable declaration
 		
 		cout << "Please enter price : RM ";
 		cin >> price;	//input 1												
 		
 		//selection based on requirement
 		if(price>=1000)
    {
			 discount = 0.05 * price;										//discount calculation
			 price_after = price - discount;			//price after discount
			 
			 cout << "The price after discount is RM ";//output 1
			 cout << fixed << setprecision(2) << price_after ;	
    }
    
    cout << "Thank you" << endl;//output 2
    
    system ("pause");
    
    return 0;
}

# data[].attributes.body
Muhammad Adib bin Mazlan(2017687274

# data[].attributes.body
Muhammad Adib bin Mazlan(2017687274

# data[].attributes.body
Muhammad Firdaus bin Ahmad Tosim(2017806184)

# data[].attributes.body
Muhammad Firdaus Bin Ahmad Tosim(2017806184

# data[].attributes.body
Muhamad Aizuddin bin Mohd Zaman

# data[].attributes.body
Muhamad Aizuddin bin Mohd Zaman

# data[].attributes.attachment_link.readable_text
/*This program will read the price from the keyboard entered by the user.

Save the program as ifelse4.cpp

PROGRAMMER: AHMAD ARIF BIN SAM'ON
DATE: 3/4/2018 
*/

#include <iostream>
#include <cmath>
#include <windows.h>

int int main()
{
    float price, discount, price_after_discount // input and output variables declaration
    
    if 

# data[].attributes.body
(2017806224)

# data[].attributes.body
Muhammad Zulhilmi Bin Alias (2017687268)

# data[].attributes.body
Muhammad Zulhilmi Bin Alias (2017687268)

# data[].attributes.body
(2017806206)

# data[].attributes.headline
NIK AHMAD RUSYDAN BIN NIK IDERIS (2017687272)

# data[].attributes.subject
NIK AHMAD RUSYDAN BIN NIK IDERIS (2017687272)

# data[].attributes.attachment_link.readable_text
/* Question 4
Prepared By: Muhammad Basher Bin Yaacob
Student ID:2017806206
*/
#include <iostream>
#include <math.h>
using namespace std;
int main()
{ 
int year ;
float Loan, Total_loan, Interest, MonthlyInstallment ;
cout << "please enter the amount of Loan" <<endl;
cin >> Loan;
cout << "please enter the installment year between 3 until 10 year only " <<endl;
cin >> year ;

if (3<=year && year<5)
{ 
Interest = 0.0067 * Loan;
Total_loan= Loan + Interest;
MonthlyInstallment = Total_loan / (year * 12);
cout<< MonthlyInstallment <<endl;
}

else  (5>=year && year<=10);
{
Interest = 0.0055 * Loan;
Total_loan= Loan + Interest;
MonthlyInstallment = Total_loan / (year * 12);
cout<< MonthlyInstallment <<endl;
}
cout << "Thank You for selecting YDL Nation Bank" <<endl;
system ("pause");
return 0;
}

# data[].attributes.headline
NIK AHMADRUSYDAN NIK IDERIS (2017687272)

# data[].attributes.subject
NIK AHMADRUSYDAN NIK IDERIS (2017687272)

# data[].attributes.body
(2017806196)

# data[].attributes.body
ifelse3

# data[].attributes.body
(2017806196)

# data[].attributes.body
2017687262

# data[].attributes.body
2017806234

# data[].attributes.attachment_link.readable_text
// This program is written by Aliff Imran 2017687262 Emd2m2a
#include <iostream>
using namespace std;
int main()
{
	int year;
	float amount_of_loan, monthly_installment, interest, total_loan;
	
	cout << "Welcome to YDL Nation Bank "<< endl;	//welcoming message
	cout << "Please enter your amount of loan " << endl; //state the amount of loan
	cin >> amount_of_loan;
	cout << "Please enter year " << endl;	//state year
	cin >> year;
 
 	if (year>=5&&year<=10)
 	   {
 	   	interest = 0.067*amount_of_loan;	//calculate the interest value 
 	   	total_loan = amount_of_loan + interest;	//calculate the total loan
 	   	monthly_installment = total_loan /(year*12);	//calculate the monthly installment
 	   	
 	   	
		}
		else if (year>=3&&year<5)
			 {
			  interest = 0.055*amount_of_loan;	//calculate the interest value
			  total_loan = amount_of_loan + interest;	//calculate the total loan
			  monthly_installment = total_loan / (year*12);	//calculate the monthly installment
			  }
  			  
  			  cout << "Your monthly installment : RM " << monthly_installment << endl;	//display the monthly installment
  			  cout << "Thank you for doing business with us "<< endl << "Have a great day" << endl;	//end message
  			  system("pause");	//stopping the system to make sure user can see the display
  			  return 0;
}

# data[].attributes.attachment_link.readable_text
// This program is written by Aliff Imran 2017687262 Emd2m2a
#include <iostream>
using namespace std;
int main()
{
	int year;
	float amount_of_loan, monthly_installment, interest, total_loan;
	
	cout << "Welcome to YDL Nation Bank "<< endl;	//welcoming message
	cout << "Please enter your amount of loan " << endl; //state the amount of loan
	cin >> amount_of_loan;
	cout << "Please enter year " << endl;	//state year
	cin >> year;
 
 	if (year>=5&&year<=10)
 	   {
 	   	interest = 0.067*amount_of_loan;	//calculate the interest value 
 	   	total_loan = amount_of_loan + interest;	//calculate the total loan
 	   	monthly_installment = total_loan /(year*12);	//calculate the monthly installment
 	   	
 	   	
		}
		else if (year>=3&&year<5)
			 {
			  interest = 0.055*amount_of_loan;	//calculate the interest value
			  total_loan = amount_of_loan + interest;	//calculate the total loan
			  monthly_installment = total_loan / (year*12);	//calculate the monthly installment
			  }
  			  
  			  cout << "Your monthly installment : RM " << monthly_installment << endl;	//display the monthly installment
  			  cout << "Thank you for doing business with us "<< endl << "Have a great day" << endl;	//end message
  			  system("pause");	//stopping the system to make sure user can see the display
  			  return 0;
}

# data[].attributes.body
ifelse4

# data[].attributes.body
2017806234

# data[].attributes.attachment_link.readable_text
// This program is written by Aliff Imran 2017687262 Emd2m2a
#include <iostream>
using namespace std;
int main()
{
	int year;
	float amount_of_loan, monthly_installment, interest, total_loan;
	
	cout << "Welcome to YDL Nation Bank "<< endl;	//welcoming message
	cout << "Please enter your amount of loan " << endl; //state the amount of loan
	cin >> amount_of_loan;
	cout << "Please enter year " << endl;	//state year
	cin >> year;
 
 	if (year>=5&&year<=10)
 	   {
 	   	interest = 0.067*amount_of_loan;	//calculate the interest value 
 	   	total_loan = amount_of_loan + interest;	//calculate the total loan
 	   	monthly_installment = total_loan /(year*12);	//calculate the monthly installment
 	   	
 	   	
		}
		else if (year>=3&&year<5)
			 {
			  interest = 0.055*amount_of_loan;	//calculate the interest value
			  total_loan = amount_of_loan + interest;	//calculate the total loan
			  monthly_installment = total_loan / (year*12);	//calculate the monthly installment
			  }
  			  
  			  cout << "Your monthly installment : RM " << monthly_installment << endl;	//display the monthly installment
  			  cout << "Thank you for doing business with us "<< endl << "Have a great day" << endl;	//end message
  			  system("pause");	//stopping the system to make sure user can see the display
  			  return 0;
}

# data[].attributes.body
ifelse4

# data[].attributes.body
2017687216
ifelse4.cpp

# data[].attributes.attachment_link.readable_text
/*
Type a program based on the following flow chart.  Your program is able to read price from the keyboard.  Save your program as .cpp.
Question 7
This program is to calculate the discount
ifelse4.cpp        
*/

//Name : Muhamad Haziq Akmal bin mohamed Laile 2017687216
//Date : 3/4/2018

#include <iostream>
using namespace std;

int main()
{
    float price;
    double discount; //declaration of the variable
    
    cout << "Enter the price please : RM " ;
    cin >> price;
    
    if(price>=1000) //selection based on the input of year
	{
    	discount = price*0.05; //calculation of the discount
    	price = price-discount; //calculation of the total price
    	cout << "\nYou get a discount of : RM " << discount << endl;
    	cout << "\nThe total price after discount is " << " RM " << price << endl; //the output of the total price
    }
	else
	{
      	cout << "\nNo discount are avalaible\n";
    }

    cout << "\nTHANK YOU" << endl;
    system("pause");
    return 0;
}

# data[].attributes.attachment_link.readable_text
/*
Type a program based on the following flow chart.  Your program is able to read price from the keyboard.  Save your program as .cpp.
Question 7
This program is to calculate the discount
ifelse4.cpp        
*/

//Name : Muhamad Haziq Akmal bin mohamed Laile 2017687216
//Date : 3/4/2018

#include <iostream>
using namespace std;

int main()
{
    float price;
    double discount; //declaration of the variable
    
    cout << "Enter the price please : RM " ;
    cin >> price;
    
    if(price>=1000) //selection based on the input of year
	{
    	discount = price*0.05; //calculation of the discount
    	price = price-discount; //calculation of the total price
    	cout << "\nYou get a discount of : RM " << discount << endl;
    	cout << "\nThe total price after discount is " << " RM " << price << endl; //the output of the total price
    }
	else
	{
      	cout << "\nNo discount are avalaible\n";
    }

    cout << "\nTHANK YOU" << endl;
    system("pause");
    return 0;
}

# data[].attributes.body
Muhamad Rahimi Bin Ramali
2017806192

# data[].attributes.headline
Siti Khaiyisah Haidah Binti Baharudin (2017687242)

# data[].attributes.subject
Siti Khaiyisah Haidah Binti Baharudin (2017687242)

# data[].attributes.body
ifelse4

# data[].attributes.body
2017889482

# data[].attributes.body
2017687266

# data[].attributes.body
2017889482

# data[].attributes.body
2017687216
ifelse3.cpp

# data[].attributes.headline
Siti Khaiyisah Haidah Binti Baharudin (2017687242)

# data[].attributes.subject
Siti Khaiyisah Haidah Binti Baharudin (2017687242)

# data[].attributes.body
ifelse3

# data[].attributes.body
2017687266

# data[].attributes.body
ifelse3

# data[].attributes.body
Khalkhalas bin Kamaludin
2017687278

# data[].attributes.attachment_link.readable_text
/* PROGRAMMER : Khalkhalas bin Kamaludin
   STUDENT ID : 2017687278
   DATE : 3/4/2018
*/
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    float price, discount, priceafterdiscount;    //declaration of input and output variables
    cout << "Hello customer\nWelcome to price reader program\n";
    cout << "Please enter the price for an item\nPrice : RM ";
    cin >> price;       // input price of an item
    if (price >= 1000)
    {
       discount = 0.05 * price;     //formula to calculate discount
       priceafterdiscount = price - discount;       //formula to calculate the price after discount
       cout << fixed << setprecision(2) << "The price after discount is RM " << priceafterdiscount << endl;       // Output the price after discount
    }
    else 
    cout << "The price is too low to get discount\n";
    cout << "Thank You\n";
    system ("pause");
}

# data[].attributes.body
ifelse3

# data[].attributes.headline
Nur Syafiah binti Muhd Ikhwan (2017687228)

# data[].attributes.subject
Nur Syafiah binti Muhd Ikhwan (2017687228)

# data[].attributes.body
Muhamad Rahimi Bin Ramali
2017806192

# data[].attributes.attachment_link.readable_text
#include<iostream>
//This program help to calculate the price after discount,if the price is more than or equal to 1000,the discount will be 5% but if less than 1000, no discount will be given.
//Formula=PriceAfterDiscount=price*(100-discount)%

//Programmer name ;Muhammad Nur Arif Bin Mohd Nadzeri(2017687256)
//Date ;3/4/2018
using namespace std;

int main()
{
	double price, price_after;
	cout<<"Please enter price ->> RM";
	cin>>price;
	
	if(price>=1000)
	{
		price_after=0.95*price;
	}
	
	else
	{
		price_after=1*price;
	}
	
	cout<<"The price after discount is RM"<<price_after;
	system("pause");
	return 0;
}

# data[].attributes.body
Muhammad Adib bin Mazlan (2017687274)

# data[].attributes.body
Khalkhalas bin Kamaludin
2017687278

# data[].attributes.attachment_link.readable_text
/*YDL Nation Bank wants to do some modification to their program so that it can help the customer to calculate the monthly installment by using new condition.
  The program however is still able to receive two inputs from the customer, which are the amount of loan in Ringgit Malaysia and year of installment.
  Based on these two inputs, the program is able to calculate the monthly installment.  The table for the interest calculation is provided as follows:
 
 | Condition | Interest (%)
 |  5 <= Year <= 10 | 6.7
 |  3 <= Year < 5 | 5.5
 
The formulas for the monthly installment calculation are as follows:
 
            Interest (RM) = Interest (%) x Amount of Loan
            Total Loan with Interest = Amount of Loan + Interest (RM)
            Monthly Installment = Total Loan with Interest / (Year of Installment x 12)

PROGRAMMER : Khalkhalas bin Kamaludin
STUDENT ID : 2017687278
DATE : 3/4/2018
*/   
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    float AmountLoan,InterestRM,TotalLoan,MonthlyInstallment;      //declaration of input and output of variables
    int InstallmentYear;
    cout << "Please insert the amount of loan in Ringgit Malaysia and year of installment\nAmount of loan in Ringgit Malaysia : ";
    cin >> AmountLoan;       //input amount of loan
    cout << "Year of installment : ";
    cin >> InstallmentYear;     // input year of installment
    if (InstallmentYear >= 5 && InstallmentYear <= 10)
    {
    InterestRM = 0.067 * AmountLoan;     // formula to calculate interest in Ringgit Malaysia
    TotalLoan = AmountLoan + InterestRM;      //formula to calculate total loan with interest
    MonthlyInstallment = TotalLoan/(InstallmentYear * 12);       //formula to calculate monthly installment
    cout << fixed << setprecision(2) << "The monthly installment is RM " << MonthlyInstallment << endl;       //output for monthly installment
    }
    else if (InstallmentYear >= 3 && InstallmentYear < 5)
    {
    InterestRM = 0.055 * AmountLoan;      // formula to calculate interest in Ringgit Malaysia
    TotalLoan = AmountLoan + InterestRM;      //formula to calculate total loan with interest
    MonthlyInstallment = TotalLoan/(InstallmentYear * 12);      //formula to calculate monthly installment
    cout << fixed << setprecision(2) << "The monthly installment is RM " << MonthlyInstallment << endl;        //output for monthly installment
    }
    else
    cout << "The installment year that you have entered is unavailable\n";
    
    system ("pause");
}

# data[].attributes.body
Mohamad Akmal bin Mohd Fazli
2017687252

# data[].attributes.body
Mohamad Akmal bin Mohd Fazli
2017687252

# data[].attributes.body
Question 4

YDL Nation Bank wants to do some modification to their program so that it can help the customer to calculate the monthly installment by using new condition.  The program however is still able to receive two inputs from the customer, which are the amount of loan in Ringgit Malaysia and year of installment.  Based on these two inputs, the program is able to calculate the monthly installment.  The table for the interest calculation is provided as follows:

| Condition | Interest (%)
|  5 ≤ Year ≤ 10 | 6.7
|  3 ≤ Year < 5 | 5.5

The formulas for the monthly installment calculation are as follows:

Interest (RM) = Interest (%) x Amount of Loan

Total Loan with Interest = Amount of Loan + Interest (RM)

Monthly Installment = Total Loan with Interest / (Year of Installment x 12)

Save the program as ifelse3.cpp

# data[].attributes.body
MUHD NIZAM(2017687236)/FARHAN( 2014878208 )

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    float loan,installment;
    int year;
    
    cout << "\n Please enter amount of LOAN : RM ";
    cin >> loan;
    cout << "\n Please enter YEARS of installment :  ";
    cin >> year;
    
    if(year<5)
    {
      installment = (loan+(loan*0.045))/(year*12);
      cout << " Monthly installment = : RM"<< installment;
       system("pause");
}
else
{
    installment = (loan+(loan*0.045))/(year*12);
      cout << " Monthly installment = : RM"<< installment;
       system("pause");
      }
}


# data[].attributes.body
MOHAMAD AZIZUL
MUHAMMAD BASHER

# data[].attributes.attachment_link.readable_text
#include <iostream>
using namespace std;
int main ()
{
    float loan, tot_loan,mon_ins, interest;
    int year;
    
    cout << "Please enter the amount of loan : RM      ";
    cin >> loan;
    
    cout<<"Enter the year of installment :       years";
    cin >> year;
    
    
    
    if (year<5)
    {
                     interest = loan*0.045;
                    tot_loan = loan + interest;
                    mon_ins = tot_loan/(year*12);
                    cout << "The amount of interest is : RM     " << interest<< endl  ;
                    cout << "The payment of loan with interest is : RM     " << tot_loan<< endl ;
                    cout << "The monthly installment is : RM     " << mon_ins  << endl;
    }
    
    
    else
    {
                     interest = loan*0.065;
                    tot_loan = loan + interest;
                    mon_ins = tot_loan/(year*12);
                    cout << "The amount of interest is : RM     " << interest<< endl  ;
                    cout << "The payment of loan with interest is : RM     " << tot_loan<< endl  ;
                    cout << "The monthly installment is : RM     " << mon_ins  << endl;
    }
    
    
    system ("pause");
    
}

# data[].attributes.body
2017687246 MOHAMAD AZIZUL BIN ABU HANIFAH
2017806206 MUHAMMAD BASHER BIN YACOB

# data[].attributes.body
MUHAMMAD SYAFIQ EIZLAN BIN TAIP (2016144111)

# data[].attributes.body
MUHAMMAD SYAFIQ EIZLAN BIN TAIP (2016144111)

# data[].attributes.body
MUHAMMAD FIRDAUS BIN AHMAD TOSIM (2017806184)
ALIFF IMRAN BIN ROZIMAN
(2017687262)

# data[].attributes.attachment_link.readable_text
//This program is written by Firdaus And Imran
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
    float loan, minstall;
    int year;

          cout << "\n Please enter amount of LOAN : RM " ;
          cin >> loan ;
           cout << "\n Please enter how many YEARS of installment :    " ;
          cin >> year ;

          if(year<5)
          {
                   minstall=(loan+(loan*0.045))/(year*12);
                   cout << "\n Loan : RM " << loan << "\n Year : " << year << "\n Interest (4.5%): RM " << (loan*0.045) ;
                   cout << " \n\nMonthly installment = : RM  " << minstall ;
                   system("pause");
          }
          else
          {
                   minstall=(loan+(loan*0.065))/(year*12);
                   cout << "\n Loan : RM " << loan << "\n Year : " << year << "\n Interest (6.5%): RM " << (loan*0.065) ;
                   cout << " \n\nMonthly installment = : RM  " << minstall ;
                   system("pause");
          }
}
