bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_2 / eduincs / pgrm_010.cpp

pgrm_010.cpp (501B)


      1 /* Default argument */
      2 
      3 #include<iostream>
      4 using namespace std;
      5 class Interest {
      6 public: 
      7     float simpleInterest(float p, float t = 5.0, float r = 1.0) {
      8         return (p * t * r) / 100;
      9     }
     10 };
     11 
     12 int main() {
     13     Interest obj;
     14     cout << "Principle only = " << obj.simpleInterest(10000) << endl;
     15     cout << "Principle and Time = " << obj.simpleInterest(10000, 8.0f) << endl;
     16     cout << "Principle, Time and Rate of Interest = " << obj.simpleInterest(10000, 8.0f, 5.0f) << endl;
     17     return 0;
     18 }