Lab 2 IF ELSE.docx - 1 A bank provide service personal loan...

This preview shows page 1 - 3 out of 7 pages.

1. A bank provide service personal loan. Loan made must not exceed from Rm200,000.00. Application conditions and number of year loan are as follows:- Number Of Year Loan Rate 1 – 2 years 3.0% 3 – 5 years 5.0% 6 – 10 years 7.0% Based on the specification above, write a program using if...else statement to help bank calculate monthly loan payment application. (CLO1, 2, 3) 25 marks #include <iostream> using namespace std; void main() { float loan,total; int year; cout<<"How much you want to loan:"; cin>>loan; { if (loan>=20000) cout<<" Sorry you have reached the loan limit"<<endl; else cout<<"Your loan is RM"<<loan<<endl; } cout<<"H0w many year you want to loan:"; cin>>year; { if (year<=2) { total=loan*0.03; cout<<"Your monthly payment is RM"<<total<<endl; } else if (year<=5) { total=loan*0.05; cout<<"Your monthly payment is RM"<<total<<endl; } else if (year<=10) { total=loan*0.1; cout<<"Your monthly payment is RM"<<total<<endl; } else { cout<<"Rejected"<<endl; } } }
Image of page 1

Subscribe to view the full document.

2. Write program using looping statement to view the result number power of two for some number that user key in. Result from the number power of two, only five number will be display as output.
Image of page 2
Image of page 3
  • Summer '16
  • Mashanum
  • Decimal, endl, cout

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern