Answer to Question #263856 in C++ for Aashi

Question #263856

WAP to calculate simple interest using class (Display principal, rate and time along with simple interest)

1
Expert's answer
2021-11-10T09:36:34-0500
#include <iostream>
#include <iomanip>
using namespace std;
class Interest{
public:
    double principal;
    double rate,simpleInterest;
    int time;
    void display(){
    cout<<"Enter the principal value: ";
    cin>>principal;
    cout<<"Enter the rate: ";
    cin>>rate;
    cout<<"Enter the time taken: ";
    cin>>time;
    cout<<"Display principal, rate and time:  "<<principal<<setw(20)<<rate<<setw(20)<<time<<endl;
    simpleInterest=rate/100*principal*time;
     cout<<"The interest is: "<<simpleInterest;
    }
};


int main()
{
   Interest s;
   s.display();
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS