Question

Imagine, you open an account with $1200 deposit at interest rate of 8% per year. Every...

Imagine, you open an account with $1200 deposit at interest rate of 8% per year.
Every year you collect the interest and withdraw $100.
Display how many years it takes until your balance goes below $100.

public static void main(String[] args)
{
while
......

}

Homework Answers

Answer #1

Code is Given Below:

==========================

public class IntrestCalc {
   public static void main(String[] args) {
       //declaring variable to hold balance and year
       double balance=1200;
       int year=0;
       //loop will run until balance is greater than 100
       while(balance>=100) {
           //incrementing year
           year++;
           //adding intrest to balance
           balance = balance +balance*0.08;
           balance=balance-100;
       }
       //display result
       System.out.println("Years = "+year);
   }

}

Output:

=============

Code Snapshot:

=====================


Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
At the end of every year you deposit $4,800 into an account that earns 8% interest...
At the end of every year you deposit $4,800 into an account that earns 8% interest per year. What will be the approximate balance in your account immediately after the 20th deposit?
You deposit $5,000 into an account at the end of year 0. You deposit $5,000 every...
You deposit $5,000 into an account at the end of year 0. You deposit $5,000 every three (3) months beginning at the end of year 1 and continuing through the end of year 3. You also deposit into the account an amount X starting at the end of year 6 and repeat it every three (3) months for a total of four (4) deposits. You withdraw $112,160 at the end of year 7. After the withdrawal at the end of...
You deposit $10000 to open an investment account. The account will earn 8% interest. Two years...
You deposit $10000 to open an investment account. The account will earn 8% interest. Two years after that deposit, you put $2500 in the account. Two years after that, you withdrawal $3000 from the account. How much money will be in the account at the end of year 6?
Problem Description: Problem Description: (The Account class) Design a class named Account that contains: A private...
Problem Description: Problem Description: (The Account class) Design a class named Account that contains: A private int data field named id for the account (default 0). A private double data field named balance for the account (default 0). A private double data field named annualInterestRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor...
Suppose that you open a mutual fund account with a deposit of $540. 5 months later,...
Suppose that you open a mutual fund account with a deposit of $540. 5 months later, the fund balance is $610, and you withdraw $192. A year after the account was opened, your balance is $. If the dollar-weighted and time-weighted yield rates were the same, what is the rate of return?
During a three year period when your income was high you were able to deposit $1200...
During a three year period when your income was high you were able to deposit $1200 at the end of each month in an account earning 12% compounded monthly.Your income went down and you could not continue the deposits. Moreover, the interest rate on your accumulated deposits fell to 8% compounded quarterly and remained at this rate for 14 years, at which time you decided to exhaust the account by withdrawing equal amounts at the end of every six months...
1) add toString method to BankAccount and SavingsAccount classes 2) Override the withdraw() in SavingsAccount so...
1) add toString method to BankAccount and SavingsAccount classes 2) Override the withdraw() in SavingsAccount so that it will not withdraw more money than is currently in the account. 3) Provide constructors for SavingsAccount 4) Add this feature to SavingsAccount: If you withdraw more than 3 times you are charged $10 fee and the fee is immediately withdrawn from your account.once a fee is deducted you get another 3 free withdrawals. 5) Implement the Comparable Interface for SavingsAccount based on...
IN JAVA PLEASE Design and implement an ADT CreditCard that represents a credit card. The data...
IN JAVA PLEASE Design and implement an ADT CreditCard that represents a credit card. The data of the ADT should include Java variables for the customer name, the account number, the next due date, the reward points, and the account balance. The initialization operation should set the data to client-supplied values. Include operations for a credit card charge, a cash advance, a payment, the addition of interest to the balance, and the display of the statistics of the account. Be...
You have an account with annual interest rate 6% compounded monthly. You will deposit $120 at...
You have an account with annual interest rate 6% compounded monthly. You will deposit $120 at the end of each month for 10 years into this account, leave the account untouched for 5 years, and then withdraw equal amounts at the end of each month for the following 15 years, ending with a balance of $15,000. What will your monthly withdrawals be?
Menu.cpp isn't working. C++  utilize inheritance to create a banking app. The architecture of the app is...
Menu.cpp isn't working. C++  utilize inheritance to create a banking app. The architecture of the app is up to you as long as you implement some form of inheritance. Below is my code however the credit and the actual menu isn't working. Can i get some help on getting the menu to work properly. // BankAccount.h #ifndef ACCOUNT_H #define ACCOUNT_H #include <string> #include <iostream> using namespace std; class BankAccount { protected : int noOfWithdrawls; private: // Declaring variables    float balance;...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT