Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi all, I\'m new to the whole computer science thing and I\'m looking for some h

ID: 3637776 • Letter: H

Question

Hi all,
I'm new to the whole computer science thing and I'm looking for some help with my class work, I have to write this program in JAVA and I have to have it read data from a file and output a table for each set of data.

LoanData.txt file includes
3
1000.00
0.035
125.00
5000.00
0.04
165.00
200000.00
0.055
1100.00

I have some of the code done, I just dont know how to display it in some sort of table or know the equation or for loop to use.

//mycode

import java.util.Scanner;
import java.io.*;

public class LoanNum
{
public static void main (String[] args) throws IOException
{


Scanner keyboard = new Scanner(System.in);

System.out.print("Enter the filename which contains your loans: ");
String filename = keyboard.nextLine();

File file = new File( filename );
Scanner inputFile = new Scanner (file);

int nTables = inputFile.nextInt();
System.out.print("Your file requires " + nTables + " scheduales to be made." );

//Table 1
// p = principal,air = annual interst rate ,mp = monthly payment
double pOne =inputFile.nextDouble();
double airOne =inputFile.nextDouble();
double mpOne =inputFile.nextDouble();

System.out.println();
System.out.println();
System.out.println("Table One");
System.out.println("Starting Balance: " +pOne);
System.out.println("Annual Interest Rate: " +airOne);
System.out.println("Monthly Payment: " +mpOne);
System.out.println();
//Table 2
double pTwo =inputFile.nextDouble();
double airTwo =inputFile.nextDouble();
double mpTwo =inputFile.nextDouble();

System.out.println("Table Two");
System.out.println("Starting Balance: " +pTwo);
System.out.println("Annual Interest Rate: " +airTwo);
System.out.println("Monthly Payment: " +mpTwo);
System.out.println();

//Table 3
double pThree =inputFile.nextDouble();
double airThree =inputFile.nextDouble();
double mpThree =inputFile.nextDouble();

System.out.println("Table Three");
System.out.println("Starting Balance: " +pThree);
System.out.println("Annual Interest Rate: " +airThree);
System.out.println("Monthly Payment: " +mpThree);
}

}


Assignment
Write a program that creates a series of one or more loan amortization schedules. The program should query the user for an input file name and an output file name. The input file will contain the number of schedules that need to be generated as well as the information needed to generate each schedule (initial loan principal, annual percentage rate, and monthly payment). Each generated amortization schedule should be well formatted and should include a breakdown of the principal and interest for each payment, the total number of monthly payments, and the total
interest paid for the life of each loan. This information should be printed to the screen as well as sent to the output file.

The program should use a separate method to calculate the amortization table(s). The program should use javadoc comments where appropriate. You will need to run javadoc against your source file to generate the javadoc HTML files.

The input file is a text file that contains integers and doubles. Each number is on its own line You can create this file using notepad or your favorite text editor. The first entry is an integer that defines the number of schedules that need to be generated using the data in the file. Each set of three lines after the first line will contain the data for a single amortization schedule. In order, they will be the principal, annual interest rate, and the monthly payment.

Example of what the first set should look like

Starting Balance: $1000.00
Annual Interest Rate: 0.035
Monthly Payment: $125.00
Payment Amount Interest Principal Balance
1 $125.00 $2.92 $122.08 $877.92
2 $125.00 $2.56 $122.44 $755.48
3 $125.00 $2.20 $122.80 $632.68
4 $125.00 $1.85 $123.15 $509.53
5 $125.00 $1.49 $123.51 $386.02
6 $125.00 $1.13 $123.87 $262.15
7 $125.00 $0.76 $124.24 $137.91
8 $125.00 $0.40 $124.60 $13.31
9 $13.35 $0.04 $13.31 $0.00
Total Payments Made: 9
Total Interest Paid: $13.35

Explanation / Answer



01 /**
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote