Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fixedExpenser;
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- //
- package budget
- * @author lilli
- */
- import java.awt.*;
- import java.awt.font.*;
- import java.awt.geom.*;
- import java.awt.image.BufferedImage;
- import java.text.*;
- import java.util.*;
- import java.util.List;
- public class accumulatedExpense{
- ///////create field ///////
- private double accCoffeeSnack;
- private double accDineOut;
- private double grocery;
- private double gasOrBus;
- private double Entertainment;
- ///////create constructor ///////
- /**
- * Set up the default;
- */
- public accExpenses(double accCoffeeSnack, accDineOut, accGrocery,
- accGasOrBus, accEntertainment) {
- this.accCoffeeSnack = newAccCoffeeSnack;
- this.accDineOut = newAccDineOut;
- this.accGrocery = newAccGrocery;
- this.accgasOrBus = newAccGasOrBus;
- this.accentertainment = newAccEntertainment;
- if (this.accCoffeeSnack||this.accDineOut||this.accGrocery||
- this.AccGasOrBus||this.AccEntertainment < 0) {
- System.out.println("All amount must be typed as a positive");
- }
- }
- //////create getter ///////
- /**
- * the getAccCoffeeSnack will return to its value : accCoffeeSanck
- */
- public double getAccCoffeeSnack() {
- return this.getAccCoffeeSnack;
- }
- /**
- * the getAccDineOut will return to its value : accDineOut
- */
- public double getAccDineOut() {
- return this.getAccDineAcout;
- }
- /**
- * the getAccGrocery will return to its value : accGrocery
- */
- public double getAccGrocery() {
- return this.getAccGrocery;
- }
- /**
- * the getTransportation will return to its value : transportation
- */
- public double getAccGasOrBus() {
- return this.getOrBus;
- }
- /**
- * the getSavingForSchool will return to its value :
- * savingForSchool
- */
- public double getSavingForSchool() {
- return this.SavingForSchool;
- }
- /**
- * the getSubscription will return to its value : subscription
- */
- public double subscription() {
- return this.subscription;
- }
- /**
- * the getType will calculation the total out the monthly fixed expense
- * and will calculate the remaining balance after the fixed expenses.
- */
- public double totalFixedExpense() {
- double sumExpense = 0.0;
- sumExpense = (getRent()+getCommunication()+getTransportation()+
- getSavingForSchool()+getSubscription())
- return sumExpense;
- }
- ///////create setter ///////
- /**
- * the setType will get the value : monthlyIncome
- */
- public void setMonthlyIncome(double monthlyIncome) {
- this.monthlyIncome = monthlyIncome;
- }
- /**
- * the setRent will get the value : Rent
- */
- public void setRent(double rent) {
- this.rent = rent;
- }
- /**
- * the setCommunication will get the value : communication
- */
- public void setCommunication(double communication) {
- this.communication = communication;
- }
- /**
- * the setTransportation will get the value : transportation
- */
- public void setTransportation(double transportation) {
- this.transportation = transportation;
- }
- /**
- * the setSavingForSchool will get the value : savingForSchool
- */
- public void setSavingForSchool(double savingForSchool) {
- this.savingForSchool = savingForSchool;
- }
- /**
- * the setSubscription will get the value : subscription
- */
- public void setSubscription(double subscription) {
- this.subscription = subscription;
- }
- ///////create method ///////
- /**
- * Method of toString will retrieve the information base on the return. On
- * this case, we will see the monthly remaining balance as the result
- */
- public String toString() {
- return "Your monthly remaining balace is: "+ this.sumExpense() + "\n";
- }
- }//end of fixedExpense Class Creation
- // TODO code application logic here
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement