关于java编程问题Write an algorithm and a program to settle the following question.A bank account starts out with an initial balance,iBalance.Interest is computed monthly at 6% per year (0.5% per month).Every month $500.00 is withdrawn to meet e

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/01 17:11:58

关于java编程问题Write an algorithm and a program to settle the following question.A bank account starts out with an initial balance,iBalance.Interest is computed monthly at 6% per year (0.5% per month).Every month $500.00 is withdrawn to meet e
关于java编程问题
Write an algorithm and a program to settle the following question.A
bank account starts out with an initial balance,iBalance.Interest is
computed monthly at 6% per year (0.5% per month).Every month $500.00
is withdrawn to meet education expenses.After how many years is the
account depleted?
There are some values for which the algorithm
you developed may not terminate.Modify your algorithm to make sure it
always terminates.The program should read the iBalance from command
line.
The input of the program is iBalance
Examples of the output of the program:
6 years and 1 month
1 year and 6 months
8 months (note that the output should not be as 0 years and 8 month)
Note:
Withdraws will be at the end of each month.For example if
the deposit is equal to 500$,then at the end of the first
month the iBalance will be equal to 500*(1+0.06/12) = 502.50
$.
By taking 500$,the iBalance will be equal to
2.5$,and at the end of the second month the iBalance will be
equal to 2.51 $.As the result at the end of the second month
the account will be depleted.
算法流程图我写的是:
(Define terms)
0.1 n=iBalance
0.2 T=month
START
1.T ← 0
2.Input n
3.While (n>0),do
3.1 n*=(1+0.06/12)
3.2 n-=500
3.3 T+=1
4.Print T
END
求java code,同时求大神帮助看看流程图有没有错误,应该怎么改正

关于java编程问题Write an algorithm and a program to settle the following question.A bank account starts out with an initial balance,iBalance.Interest is computed monthly at 6% per year (0.5% per month).Every month $500.00 is withdrawn to meet e
package com.pb.test;
public class MyPoint { private double x;
private double y;

public MyPoint(){
this.x = 0;
this.y = 0;
}

public MyPoint(double x,double y){
this.x = x;
this.y = y;
}

public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}

public double distance(MyPoint point1, MyPoint point2) {
return Math.sqrt((point1.x - point2.x) * (point1.x - point2.x)
+ (point1.y - point2.y)*(point1.y - point2.y));
}
}
看看这个,修改了distance方法,通过了测试
以上回答你满意么?

关于java编程问题Write an algorithm and a program to settle the following question.A bank account starts out with an initial balance,iBalance.Interest is computed monthly at 6% per year (0.5% per month).Every month $500.00 is withdrawn to meet e 求会英文的java大神帮忙解决一道编程题Write a program that will ask a user for the total hours worked.If the hours worked java编程问题产生100个随机数(>=1&& Java write a program to read an integer,n,from the keyboard and output n row of pascal's triangle. java编程问题 急In rolling a dice one of the six sides will appear uppermost.If a dice is rolled many thousands of times,each of the six sides should appear uppermost approximately the same number of times.Write a program that counts the number o 1. 下列关于JAVA语言特点的叙述中,错误的是[   ] A、Java是面向过程的编程语言  1. 下列关于JAVA语言特点的叙述中,错误的是[   ]A、Java是面向过程的编程语言   & JAVA问题(英文的)Write a program that assigns seats on an airplane.Assume the airplane has 20 seats in the first class (5 rows of 4 seats each,separated by an aisle) and 90 seats in economy class (15 rows of 6 seats each,separated by an aisle).Yo matlab编程问题,希望大家能帮我解决,1.Write a simple MATLAB program,using an appropriate loop structure,that prints out the string “Hello World!” to the screen exactly 10 times.2.Write a MATLAB program which continues to ask the user f Please write a Java program,compute the GreatestCommonDivisor求JAVA程序 Java编程、输入数字个数、平均数、最小值、最大值减去最小值、write a JAVA program to read in a sequence of integers and print out the following quantities,each on a new line and in the following order,your program should be:1) Java编程、输入数字个数、平均数、最小值、最大值减去最小值、write a JAVA program to read in a sequence of integers and print out the following quantities,each on a new line and in the following order,your program should be:1) java编程:字符串this is a test 倒序输出 test is a this 编程语言 “JAVA” 这个词怎么读?发音?或者就是J A V A how to write this java program?write an application that prints the phrase Knowledge is power:a.on one line b.on three lines,one word per line,with the words ccentered relative each otheri want to know how to write an application,not the meaning in 关于java的length一些问题while(x Java write a program to calculate the factorial of any natural number entered by a user. java程序问题?下面是一个 5*5 的螺旋方阵(顺时针方向旋转)编程输出 10*10(n 求java编程题目解:编程求解鸡兔问题,鸡兔共有49只,但有100只足,计算鸡兔各多少只?