Advertisement
Guest User

Untitled

a guest
May 21st, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.16 KB | None | 0 0
  1. package fixedExpenser;
  2.  
  3. /*
  4. * To change this license header, choose License Headers in Project Properties.
  5. * To change this template file, choose Tools | Templates
  6. * and open the template in the editor.
  7.  
  8. //
  9. package budget
  10. * @author lilli
  11. */
  12.  
  13. import java.awt.*;
  14. import java.awt.font.*;
  15. import java.awt.geom.*;
  16. import java.awt.image.BufferedImage;
  17. import java.text.*;
  18. import java.util.*;
  19. import java.util.List;
  20.  
  21. public class accumulatedExpense{
  22. ///////create field ///////
  23.  
  24. private double accCoffeeSnack;
  25. private double accDineOut;
  26. private double grocery;
  27. private double gasOrBus;
  28. private double Entertainment;
  29.  
  30. ///////create constructor ///////
  31. /**
  32. * Set up the default;
  33. */
  34. public accExpenses(double accCoffeeSnack, accDineOut, accGrocery,
  35. accGasOrBus, accEntertainment) {
  36.  
  37. this.accCoffeeSnack = newAccCoffeeSnack;
  38. this.accDineOut = newAccDineOut;
  39. this.accGrocery = newAccGrocery;
  40. this.accgasOrBus = newAccGasOrBus;
  41. this.accentertainment = newAccEntertainment;
  42.  
  43.  
  44. if (this.accCoffeeSnack||this.accDineOut||this.accGrocery||
  45. this.AccGasOrBus||this.AccEntertainment < 0) {
  46. System.out.println("All amount must be typed as a positive");
  47. }
  48. }
  49. //////create getter ///////
  50.  
  51. /**
  52. * the getAccCoffeeSnack will return to its value : accCoffeeSanck
  53. */
  54. public double getAccCoffeeSnack() {
  55. return this.getAccCoffeeSnack;
  56. }
  57.  
  58. /**
  59. * the getAccDineOut will return to its value : accDineOut
  60. */
  61. public double getAccDineOut() {
  62. return this.getAccDineAcout;
  63. }
  64.  
  65. /**
  66. * the getAccGrocery will return to its value : accGrocery
  67. */
  68. public double getAccGrocery() {
  69. return this.getAccGrocery;
  70. }
  71.  
  72. /**
  73. * the getTransportation will return to its value : transportation
  74. */
  75. public double getAccGasOrBus() {
  76. return this.getOrBus;
  77. }
  78.  
  79. /**
  80. * the getSavingForSchool will return to its value :
  81. * savingForSchool
  82. */
  83. public double getSavingForSchool() {
  84. return this.SavingForSchool;
  85. }
  86.  
  87. /**
  88. * the getSubscription will return to its value : subscription
  89. */
  90. public double subscription() {
  91. return this.subscription;
  92. }
  93.  
  94. /**
  95. * the getType will calculation the total out the monthly fixed expense
  96. * and will calculate the remaining balance after the fixed expenses.
  97. */
  98. public double totalFixedExpense() {
  99. double sumExpense = 0.0;
  100.  
  101. sumExpense = (getRent()+getCommunication()+getTransportation()+
  102. getSavingForSchool()+getSubscription())
  103.  
  104. return sumExpense;
  105. }
  106.  
  107. ///////create setter ///////
  108. /**
  109. * the setType will get the value : monthlyIncome
  110. */
  111. public void setMonthlyIncome(double monthlyIncome) {
  112. this.monthlyIncome = monthlyIncome;
  113. }
  114.  
  115. /**
  116. * the setRent will get the value : Rent
  117. */
  118. public void setRent(double rent) {
  119. this.rent = rent;
  120. }
  121.  
  122. /**
  123. * the setCommunication will get the value : communication
  124. */
  125. public void setCommunication(double communication) {
  126. this.communication = communication;
  127. }
  128.  
  129. /**
  130. * the setTransportation will get the value : transportation
  131. */
  132. public void setTransportation(double transportation) {
  133. this.transportation = transportation;
  134. }
  135.  
  136. /**
  137. * the setSavingForSchool will get the value : savingForSchool
  138. */
  139. public void setSavingForSchool(double savingForSchool) {
  140. this.savingForSchool = savingForSchool;
  141. }
  142.  
  143. /**
  144. * the setSubscription will get the value : subscription
  145. */
  146. public void setSubscription(double subscription) {
  147. this.subscription = subscription;
  148. }
  149.  
  150. ///////create method ///////
  151. /**
  152. * Method of toString will retrieve the information base on the return. On
  153. * this case, we will see the monthly remaining balance as the result
  154. */
  155. public String toString() {
  156. return "Your monthly remaining balace is: "+ this.sumExpense() + "\n";
  157. }
  158. }//end of fixedExpense Class Creation
  159.  
  160.  
  161. // TODO code application logic here
  162. }
  163.  
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement