So i have a class project due at midnight and it's causing me a great deal of problems right now and I would appreciate any help I could get from anybody. the prompt is as follows;
Input Specification:
<Introductory Message Describing Program>
Please enter the initial balance: 1000.00
Please enter the interest rate: 6.50
Please enter the number of years: 10
Output Specification
Ensure your columns are aligned for the sample input given above. Large balances may throw off your spacing. Again, that's OK.
Required Methods
Implement each of these methods exactly as specified, including the parameters and return values
// inform user what program will compute
void printIntro ( )
// This method is responsible for printing the headers for the table and generating the content of the table – it should call
// printRow to print each individual row of the table
void printTable (int numRows, double balance, double rate)
// This method is responsible for printing a single row of the table
void printRow (int rowNum, double balance, double interest)
// This method calculates and returns the amount of interest
double calcInterest (double balance, double rate)
didn't realize the pic would be that tiny. here it is written out;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Interest {
public static void main(String[] args) {
// TODO Auto-generated method stub
printIntro();
System.out.println();
Scanner console = new Scanner(System.in);
// get initial balance
System.out.println("Please enter the initial balance: ");
double balance = console.nextDouble();
// get interest rate
System.out.println("Please enter the interest rate: ");
double rate = console.nextDouble();
// get time
System.out.println("Please enter the number of years");
int time = console.nextInt();
printTable(time, balance, rate);
}
//tells the user what this program will do
public static void printIntro() {
System.out.println("Given the initial balance, interest rate, and time, this program will compute the new balance of the CD.");
}
// prints headers for table and calculates number content within the table by calling printRow method
public static void printTable(int time, double balance, double rate) {
System.out.println("Year \t Balance \t Interest \t New Balance");
System.out.println("---- \t ------- \t -------- \t -----------");
printRow(time, balance, calcInterest(balance, rate));
}
// prints a single row of the table
public static void printRow(int time, double balance, double interest) {
double newBalance = balance + interest;
//prints number of years entered by user onto table
for (int i = 1; i <= time; i++){
System.out.println(i + "\t" + balance + "\t" + interest + "\t" + newBalance);
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.