Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem Statement: Expense class You are required to write a class name “Expense

ID: 3616114 • Letter: P

Question

Problem Statement: Expense class

You are required to write a class name “Expenses “.Expenses class has

· Constructors

· Destructor

· Write a function to add expenses for a month

· Write function which displays these expenses.

· Write a function which calculates savings for amonth.  

· Expense class has following data members

o Total Income     // total income ofperson/family

o Gbill          //Gasbill

oEbill          //Electricitybill

o Wbill         // waterBill

o OExpenses    // any other expenses

o Month       //Month for whichyou are calculating these expenses

You have to populate all these record on monthly basis; topopulate records; you have to use getter and setters for all datamembers.

Explanation / Answer

/*
Problem Statement: Expense class
You are required to write a class name “Expenses “.Expenses class has
• Constructors
• Destructor
• Write a function to add expenses for a month
• Write function which displays these expenses.
• Write a function which calculates savings for a month.
• Expense class has following data members
o Total Income // total income of person/family
o Gbill //Gas bill
o Ebill //Electricity bill
o Wbill // water Bill
o OExpenses // any other expenses
o Month //Month for which you are calculating these expenses
*/

#include<iostream>
#include<string>
using namespace std;

Expenses::Expenses(){
totalIncome = 0.0;
Gbill = 0.0;
Wbill = 0.0;
Oexpenses = 0.0;
Month = " ";
}
//********************************
double Expenses::addExpenses(){
return Gbill + Wbill + Oexpenses;

}
//*******************************
void Expenses::printExpenses(){
cout<<"Gas Bill: " << Gbill << endl;
cout<<"Water Bill: " << Wbill << endl;
cout<<"Other: " << Oexpenses << endl;
}
//**********************************
double Expenses::savings(){
return totalIncome - addExpenses();

}
//***********************************
void Expenses::setIncome(double money){
totalIncome = money;
}
//*********************************
double Expenses::getInclome(){
return totalIncome;

}
//**********************************
double Expenses::getGbill(){
return Gbill;
}
//**************************************
void Expenses::setGbill(double bill){
Gbill = bill;
}
//**************************************
double Expenses::getWbill(){
return Wbill;
}
//***********************************
void Expenses::setWbill(double bill){
  Wbill = bill;

}
//*****************************************
double Expenses::Oexpense(){
return Oexpenses;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote