1. 2 + In the Savings Account class, declare/Initialize variables based on the table below. Develop...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. 2 + In the Savings Account class, declare/Initialize variables based on the table below. Develop a simple program for an individual savings account. Create two (2) classes named Savings Account (no class modifier) and Run Savings Account (public). Data Type double double Access Level Static? Variable Name balance interestRate private public No Yes Value None 0 3. Within the constructor, initialize balance with the value of 0. 4. Declare a static setter method named setInterestRate with a parameter of double type named newRate. This method should assign newRate to interestRate. All methods in the program should be public. 5. Add a static method named getinterestRate and a non-static method named getBalance, where each returns an appropriate variable. Both should of double type. 6. Declare a void method named deposit with a parameter of double type named amount. This method should update balance by adding an amount to it. 7. Add another method of double type named withdraw with a parameter of double type also named as amount. Create an if-else statement based on this condition: If balance is greater than or equal than amount, deduct amount from balance; else, amount is equal to 0. Return the amount afterwards. 8. Add a void method named addinterest. Within this method, declare a double variable named interest that accepts the product of balance and interestRate. Update balance by adding interest to it. 9. Declare a void static method named showBalance with a parameter of Savings Account type named account. This method should display the current balance of the account by calling the getBalance() method using the object account. 10. Move to the other class, Run Savings Account. Import the Scanner class for the user input. 11. Instantiate a Savings Account object named savings in the main method to use the methods you have created earlier. This should be the expected sequence of the program upon execution: a. Ask the user to input the interest rate. b. C. Ask the user to type an amount to be deposited. Ask the user to press either D for another deposit or W for withdraw. Show balance afterward. If savings is greater than 1000, display the new balance with applied interest. 1. 2 + In the Savings Account class, declare/Initialize variables based on the table below. Develop a simple program for an individual savings account. Create two (2) classes named Savings Account (no class modifier) and Run Savings Account (public). Data Type double double Access Level Static? Variable Name balance interestRate private public No Yes Value None 0 3. Within the constructor, initialize balance with the value of 0. 4. Declare a static setter method named setInterestRate with a parameter of double type named newRate. This method should assign newRate to interestRate. All methods in the program should be public. 5. Add a static method named getinterestRate and a non-static method named getBalance, where each returns an appropriate variable. Both should of double type. 6. Declare a void method named deposit with a parameter of double type named amount. This method should update balance by adding an amount to it. 7. Add another method of double type named withdraw with a parameter of double type also named as amount. Create an if-else statement based on this condition: If balance is greater than or equal than amount, deduct amount from balance; else, amount is equal to 0. Return the amount afterwards. 8. Add a void method named addinterest. Within this method, declare a double variable named interest that accepts the product of balance and interestRate. Update balance by adding interest to it. 9. Declare a void static method named showBalance with a parameter of Savings Account type named account. This method should display the current balance of the account by calling the getBalance() method using the object account. 10. Move to the other class, Run Savings Account. Import the Scanner class for the user input. 11. Instantiate a Savings Account object named savings in the main method to use the methods you have created earlier. This should be the expected sequence of the program upon execution: a. Ask the user to input the interest rate. b. C. Ask the user to type an amount to be deposited. Ask the user to press either D for another deposit or W for withdraw. Show balance afterward. If savings is greater than 1000, display the new balance with applied interest.
Expert Answer:
Answer rating: 100% (QA)
SavingsAccountjava public class Savings Account private static double balance public double inte... View the full answer
Posted Date:
Students also viewed these human resource management questions
-
Create a 3 2 contingency table with row totals of 25, 30, and 25 and column totals of 30 and 50. How many table cell counts are truly free (i. e., what is the smallest number of table cell counts...
-
Public Schools and Private School Vouchers: Consider a simple model of how economic circumstances are changed when the government enters the education market. A: Suppose a household has an after-tax...
-
Public School Teacher Salaries, Class Size and Private School Markets: In exercise 14.10, we noted that private schools that charge tuition operate alongside public schools in U.S. cities. There is...
-
In baseball, a players batting average is the proportion of times the player gets a hit out of his total number of times at bat. The distribution of batting averages in a recent season for Major...
-
The article Truth and DARE: Tracking Drug Education to Graduation (Social Problems [1994]: 448 456) compared the drug use of 288 randomly selected high school seniors exposed to a drug education...
-
Jamie Wong is considering building an investment portfolio containing two stocks, L and M. Stock L will represent 40% of the dollar value of the portfolio, and stock M will account for the other 60%....
-
Two vertical parallel rails made of material that is an electrical conductor are \(80.0 \mathrm{~mm}\) apart (Figure P27.29). A wire \(80.0 \mathrm{~mm}\) long is free to slide along the rails, which...
-
Mogoul Manufacturing Company makes two different products, M and N. The companys two departments are named after the products; for example, Product M is made in Department M. Mogouls accountant has...
-
6. For which of following reversible reaction the degree of dissociation or association depends upon the value of temperature but NOT on value of pressure? (a) N2(g)+3H2(g)2NH3(g) (b) N2O4(g) 2NO2(g)...
-
The Electret microphone AUM-5047L we will use can be modeled as a Norton current source, with DC current IMIC as shown below. We need to set up its DC operating point correctly, by an appropriate...
-
XYZ is contemplating either the outright purchase today or a lease of a major piece of machinery and wants you to recommend which would be preferable - lease or buy. The following are the terms...
-
It is Monday, and today is your first day in your new marketing internship. After a rigorous application and review process including two grueling interviews with Cory Rogers and Celeste Brown, you...
-
Determine the characteristic impedance of a transmission line that the relation below is true for its parameters: \[ \frac{R}{L}=\frac{G}{C} \] 1) \(\frac{R}{L}\). 2) \(\infty\). 3) 0 . 4) It is...
-
Calculate the charging current ( \(\mathbf{I}_{\text {Charging }}\) ) of a long transmission line. 1) \(\frac{\mathbf{V}_{\mathrm{s}} \tanh (\gamma l)}{\mathbf{Z}_{\mathrm{c}}}\) 2)...
-
In 2001 , investor Warren Buffett had this to say about pension accounting: Unfortunately, the subject of pension [return] assumptions, critically important though it is, almost never comes up in...
-
What is auditing?
-
According to the "impossible trinity," it is not possible to simultaneously have 1) a fixed exchange rate regime, 2) perfect capital mobility, and 3) an independent monetary policy. Based on the...
-
2. In the circuit given in Figure 2, i,(t) = 5.67cos(5t)A and v (t) = 70.71 cos(5t 60) V a) Find the equivalent load impedance. State whether the load is inductive or capacitive. b) Calculate the...
-
What is the difference between leading zeros and trailing zeros? Which ones are considered significant digits?
-
What is the simplest way to convert a quantity given in one unit to the same quantity given in a different unit?
-
Explain the difference between number of digits, number of decimal places, and number of significant digits in a numerical value. Illustrate your explanation using the number 0.03720 .
Study smarter with the SolutionInn App