can anyone help me? i got problem count the monthly installment.
//class
class vehicle
{
public:
char model[20], color[20], brand[20];
float price, deposit, rate, monthly_installment, newprice;
int term;
public:
void calculate_installment();
};
class car:public vehicle
{
private:
float installment, newprice;
public:
void calculate_installment();
};
//main program
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include "classvehicle.h"
using namespace std;
int main()
{
vehicle vehicle1;
car car1;
vehicle1.calculate_installment();
car1.calculate_installment();
//system ("PAUSE");
}
void vehicle::calculate_installment()
{
cout<<"\n Program to calculate car price:";
cout<<"\n Model:";
cin>>model;
cout<<"\n Color:";
cin>>color;
cout<<"\n Brand:";
cin>>brand;
cout<<"\n Program to calculate new price of car:";
cout<<"\n Price of car :";
cin>>price;
cout<<"\n Deposit:";
cin>>deposit;
newprice = price - deposit;
cout<<"\n The new price of car is :" <<newprice<<endl;
}
void car::calculate_installment()
{
cout<<"\n Program to new price installment:";
cout<<"\n Rate of car :";
cin>>rate;
cout<<"\n Term of car:";
cin>>term;
installment= newprice+(rate*term);
cout<<"\n The new price installment is :" <<installment<<endl;
monthly_installment = installment/(term*12);
cout<<"\n The montly installment that have to pay is :" <<monthly_installment <<endl;
}