I having the fallowing error on my c++ program.
"MonthlyBudget.hpp: No such file or directory"
#ifndef MonthlyBudget_hpp
#define MonthlyBudget_hpp
#include <stdio.h>
#include <iostream>
using namespace std;
class MonthlyBudget {
public:
void settotalbudget(double);
double gettotalbudget();
void setsavings(double);
double getsavings();
void sethousing(double);
double gethousing();
void setutilities(double);
double getutilities();
void sethousehold_exp(double);
double gethousehold_exp();
void settransportation(double);
double gettransportation();
void setfood(double);
double getfood();
void setmedical(double);
double getmedical();
void setinsurance(double);
double getinsurance();
void setentertainment(double);
double getentertainment();
void setclothing(double);
double getclothing();
void setmisc(double);
double getmisc();
MonthlyBudget get_spent();
MonthlyBudget calculate_budget(MonthlyBudget);
void output(MonthlyBudget);
private:
double totalbudget;
double savings;
double housing;
double utilities;
double household_exp;
double transportation;
double food;
double medical;
double insurance;
double entertainment;
double clothing;
double misc;
};
#endif /* MonthlyBudget_hpp */
#include "MonthlyBudget.hpp"
void MonthlyBudget :: settotalbudget(double total){
totalbudget = total;
}
double MonthlyBudget :: gettotalbudget(){
return totalbudget;
}
void MonthlyBudget :: setsavings(double savingsAmount){
savings = savingsAmount;
}
double MonthlyBudget :: getsavings(){
return savings;
}
void MonthlyBudget :: sethousing(double housingAmount){
housing = housingAmount;
}
double MonthlyBudget :: gethousing(){
return housing;
}
void MonthlyBudget :: setutilities(double utilitiesAmount){
utilities = utilitiesAmount;
}
double MonthlyBudget :: getutilities(){
return utilities;
}
void MonthlyBudget :: sethousehold_exp(double household_expAmount){
household_exp = household_expAmount;
}
double MonthlyBudget :: gethousehold_exp(){
return household_exp;
}
void MonthlyBudget :: settransportation(double transportationAmount){
transportation = transportationAmount;
}
double MonthlyBudget :: gettransportation(){
return transportation;
}
void MonthlyBudget :: setfood(double foodAmount){
food = foodAmount;
}
double MonthlyBudget :: getfood(){
return food;
}
void MonthlyBudget :: setmedical(double medicalAmount){
medical = medicalAmount;
}
double MonthlyBudget ::getmedical(){
return medical;
}
void MonthlyBudget :: setinsurance(double insuranceAmount){
insurance = insuranceAmount;
}
double MonthlyBudget :: getinsurance(){
return insurance;
}
void MonthlyBudget :: setentertainment(double entertainmentAmount){
entertainment = entertainmentAmount;
}
double MonthlyBudget :: getentertainment(){
return entertainment;
}
void MonthlyBudget :: setclothing(double clothingAmount){
clothing = clothingAmount;
}
double MonthlyBudget :: getclothing(){
return clothing;
}
void MonthlyBudget :: setmisc(double miscAmount){
misc = miscAmount;
}
double MonthlyBudget :: getmisc(){
return misc;
}
MonthlyBudget MonthlyBudget :: get_spent(){
double total, housing,utilities,household_exp,transportation,food,medical,insurance,entertainment,clothing,misc;
cout<<"Enter total budget for the month";
cin>>total;
cout<<"Enter in Housing Expense: ";
cin>>housing;
cout<<"Enter in Utilities Expense: ";
cin>>utilities;
cout<<"Enter in Household Expenses: ";
cin>>household_exp;
cout<<"Enter in Transportation Expense: ";
cin>>transportation;
cout<<"Enter in Food Expense: ";
cin>>food;
cout<<"Enter in Medical Expense: ";
cin>>medical;
cout<<"Enter in Insurance Expense: ";
cin>>insurance;
cout<<"Enter in Entertainment Expense: ";
cin>>entertainment;
cout<<"Clothing Expense: ";
cin>>clothing;
cout<<"Enter in Miscellaneous Expenses: ";
cin>>misc;
MonthlyBudget spent_budget;
spent_budget.settotalbudget(total);
spent_budget.sethousing(housing);
spent_budget.setutilities(utilities);
spent_budget.sethousehold_exp(household_exp);
spent_budget.settransportation(transportation);
spent_budget.setfood(food);
spent_budget.setmedical(medical);
spent_budget.setinsurance(insurance);
spent_budget.setentertainment(entertainment);
spent_budget.setclothing(clothing);
spent_budget.setmisc(misc);
return spent_budget;
}
MonthlyBudget MonthlyBudget :: calculate_budget(MonthlyBudget spent_budget){
MonthlyBudget calculate_budget;
calculate_budget = spent_budget;
calculate_budget.setsavings(spent_budget.gettotalbudget() - spent_budget.gethousing() - spent_budget.getutilities() - spent_budget.gethousehold_exp() - spent_budget.gettransportation() - spent_budget.getfood() - spent_budget.getmedical() - spent_budget.getinsurance() - spent_budget.getentertainment() - spent_budget.getclothing() - spent_budget.getmisc());
return calculate_budget;
}
void MonthlyBudget:: output(MonthlyBudget outputBudget)
{
cout << "Total Budget for the month is \t\t"<<outputBudget.totalbudget<<"\n";
cout<<"Category\t\t"<<"Spent\t"<<"Percentage of total spent \n"
"------------------------------------------------------------\n"
"Housing\t\t"<<outputBudget.gethousing()<<"\t"<<(outputBudget.gethousing()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Utilities\t\t"<<outputBudget.getutilities()<<"\t"<<(outputBudget.getutilities()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Household_Exp\t\t"<<outputBudget.gethousehold_exp()<<"\t"<<(outputBudget.gethousehold_exp()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Transportation\t\t"<<outputBudget.gettransportation()<<"\t"<<(outputBudget.gettransportation()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Food\t\t"<<outputBudget.getfood()<<"\t"<<(outputBudget.getfood()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Medical\t\t"<<outputBudget.getmedical()<<"\t"<<(outputBudget.getmedical()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Insurance\t\t"<<outputBudget.getinsurance()<<"\t"<<(outputBudget.getinsurance()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Entertainment\t\t"<<outputBudget.getentertainment()<<"\t"<<(outputBudget.getentertainment()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Clothing\t\t"<<outputBudget.getclothing()<<"\t"<<(outputBudget.getclothing()/outputBudget.gettotalbudget())*!00<<"\t\t\n"
"Miscellaneous\t\t"<<outputBudget.getmisc()<<"\t"<<(outputBudget.getmisc()/outputBudget.gettotalbudget())*100<<"\t\t\n";
cout << "Total Savings for the month is \t\t"<<outputBudget.getsavings() <<"\n";
}
#include "MonthlyBudget.hpp"
int main(){
MonthlyBudget myBudget;
MonthlyBudget spentBudget = myBudget.get_spent();
MonthlyBudget calculateBudget = myBudget.calculate_budget(spentBudget);
myBudget.output(calculateBudget);
return 0;
}
-------------MonthlyBudget.hpp---------------
#ifndef MonthlyBudget_hpp
#define MonthlyBudget_hpp
#include <stdio.h>
#include <iostream>
using namespace std;
class MonthlyBudget {
public:
void settotalbudget(double);
double gettotalbudget();
void setsavings(double);
double getsavings();
void sethousing(double);
double gethousing();
void setutilities(double);
double getutilities();
void sethousehold_exp(double);
double gethousehold_exp();
void settransportation(double);
double gettransportation();
void setfood(double);
double getfood();
void setmedical(double);
double getmedical();
void setinsurance(double);
double getinsurance();
void setentertainment(double);
double getentertainment();
void setclothing(double);
double getclothing();
void setmisc(double);
double getmisc();
MonthlyBudget get_spent();
MonthlyBudget calculate_budget(MonthlyBudget);
void output(MonthlyBudget);
private:
double totalbudget;
double savings;
double housing;
double utilities;
double household_exp;
double transportation;
double food;
double medical;
double insurance;
double entertainment;
double clothing;
double misc;
};
#endif /* MonthlyBudget_hpp */
---------------MonthlyBudget.cpp--------------
#include "MonthlyBudget.hpp"
void MonthlyBudget :: settotalbudget(double total){
totalbudget = total;
}
double MonthlyBudget :: gettotalbudget(){
return totalbudget;
}
void MonthlyBudget :: setsavings(double savingsAmount){
savings = savingsAmount;
}
double MonthlyBudget :: getsavings(){
return savings;
}
void MonthlyBudget :: sethousing(double housingAmount){
housing = housingAmount;
}
double MonthlyBudget :: gethousing(){
return housing;
}
void MonthlyBudget :: setutilities(double utilitiesAmount){
utilities = utilitiesAmount;
}
double MonthlyBudget :: getutilities(){
return utilities;
}
void MonthlyBudget :: sethousehold_exp(double household_expAmount){
household_exp = household_expAmount;
}
double MonthlyBudget :: gethousehold_exp(){
return household_exp;
}
void MonthlyBudget :: settransportation(double transportationAmount){
transportation = transportationAmount;
}
double MonthlyBudget :: gettransportation(){
return transportation;
}
void MonthlyBudget :: setfood(double foodAmount){
food = foodAmount;
}
double MonthlyBudget :: getfood(){
return food;
}
void MonthlyBudget :: setmedical(double medicalAmount){
medical = medicalAmount;
}
double MonthlyBudget ::getmedical(){
return medical;
}
void MonthlyBudget :: setinsurance(double insuranceAmount){
insurance = insuranceAmount;
}
double MonthlyBudget :: getinsurance(){
return insurance;
}
void MonthlyBudget :: setentertainment(double entertainmentAmount){
entertainment = entertainmentAmount;
}
double MonthlyBudget :: getentertainment(){
return entertainment;
}
void MonthlyBudget :: setclothing(double clothingAmount){
clothing = clothingAmount;
}
double MonthlyBudget :: getclothing(){
return clothing;
}
void MonthlyBudget :: setmisc(double miscAmount){
misc = miscAmount;
}
double MonthlyBudget :: getmisc(){
return misc;
}
MonthlyBudget MonthlyBudget :: get_spent(){
double total, housing,utilities,household_exp,transportation,food,medical,insurance,entertainment,clothing,misc;
cout<<"Enter total budget for the month";
cin>>total;
cout<<"Enter in Housing Expense: ";
cin>>housing;
cout<<"Enter in Utilities Expense: ";
cin>>utilities;
cout<<"Enter in Household Expenses: ";
cin>>household_exp;
cout<<"Enter in Transportation Expense: ";
cin>>transportation;
cout<<"Enter in Food Expense: ";
cin>>food;
cout<<"Enter in Medical Expense: ";
cin>>medical;
cout<<"Enter in Insurance Expense: ";
cin>>insurance;
cout<<"Enter in Entertainment Expense: ";
cin>>entertainment;
cout<<"Clothing Expense: ";
cin>>clothing;
cout<<"Enter in Miscellaneous Expenses: ";
cin>>misc;
MonthlyBudget spent_budget;
spent_budget.settotalbudget(total);
spent_budget.sethousing(housing);
spent_budget.setutilities(utilities);
spent_budget.sethousehold_exp(household_exp);
spent_budget.settransportation(transportation);
spent_budget.setfood(food);
spent_budget.setmedical(medical);
spent_budget.setinsurance(insurance);
spent_budget.setentertainment(entertainment);
spent_budget.setclothing(clothing);
spent_budget.setmisc(misc);
return spent_budget;
}
MonthlyBudget MonthlyBudget :: calculate_budget(MonthlyBudget spent_budget){
MonthlyBudget calculate_budget;
calculate_budget = spent_budget;
calculate_budget.setsavings(spent_budget.gettotalbudget() - spent_budget.gethousing() - spent_budget.getutilities() - spent_budget.gethousehold_exp() - spent_budget.gettransportation() - spent_budget.getfood() - spent_budget.getmedical() - spent_budget.getinsurance() - spent_budget.getentertainment() - spent_budget.getclothing() - spent_budget.getmisc());
return calculate_budget;
}
void MonthlyBudget:: output(MonthlyBudget outputBudget)
{
cout << "Total Budget for the month is \t\t"<<outputBudget.totalbudget<<"\n";
cout<<"Category\t\t"<<"Spent\t"<<"Percentage of total spent \n"
"------------------------------------------------------------\n"
"Housing\t\t"<<outputBudget.gethousing()<<"\t"<<(outputBudget.gethousing()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Utilities\t\t"<<outputBudget.getutilities()<<"\t"<<(outputBudget.getutilities()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Household_Exp\t\t"<<outputBudget.gethousehold_exp()<<"\t"<<(outputBudget.gethousehold_exp()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Transportation\t\t"<<outputBudget.gettransportation()<<"\t"<<(outputBudget.gettransportation()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Food\t\t"<<outputBudget.getfood()<<"\t"<<(outputBudget.getfood()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Medical\t\t"<<outputBudget.getmedical()<<"\t"<<(outputBudget.getmedical()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Insurance\t\t"<<outputBudget.getinsurance()<<"\t"<<(outputBudget.getinsurance()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Entertainment\t\t"<<outputBudget.getentertainment()<<"\t"<<(outputBudget.getentertainment()/outputBudget.gettotalbudget())*100<<"\t\t\n"
"Clothing\t\t"<<outputBudget.getclothing()<<"\t"<<(outputBudget.getclothing()/outputBudget.gettotalbudget())*!00<<"\t\t\n"
"Miscellaneous\t\t"<<outputBudget.getmisc()<<"\t"<<(outputBudget.getmisc()/outputBudget.gettotalbudget())*100<<"\t\t\n";
cout << "Total Savings for the month is \t\t"<<outputBudget.getsavings() <<"\n";
}
-----------------main.cpp-------------
#include "MonthlyBudget.cpp"
int main(){
MonthlyBudget myBudget;
MonthlyBudget spentBudget = myBudget.get_spent();
MonthlyBudget calculateBudget = myBudget.calculate_budget(spentBudget);
myBudget.output(calculateBudget);
return 0;
}
Sample Output

I having the fallowing error on my c++ program. "MonthlyBudget.hpp: No such file or directory" #ifndef...