Creates a carloan class object

Assignment Help JAVA Programming
Reference no: EM131567060

Assignment

A bank has been asked to go back and reprocess the loan payments for a car loan. A customer does not believe the bank has the correct outstanding balance for the loan.

The loan characteristics are:

a. Total amount of loan: $18,875
a. Term of loan: 60 months
a. Loan interest rate: 0%
a. Remaining loan balance: $12,500

($12,500). of $18,875. The car loan is a 0% interest loan. The loan is for 60 months and the bank records indicate that the customer's remaining balance is $12,500. The customer does not believe the bank has the correct outstanding balance for her loan.

The customer's records indicate that the remaining loan balance is $11,427. The customer has receipts that show that 20 loan payments have been paid in the following whole dollar amounts: 315, 451, 315, 374, 353, 315, 450, 484, 412, 315, 495, 476, 321, 315, 406, 329, 326, 356, 315, 325.

First, using the following "BankAccount" class as the base class (superclass), create a "CarLoan" derived class (subclass) that extends the BankAccount class. The "CarLoan" class will use an overloaded constructor to initialize the car loan balance (using "super" in the subclass constructor to set the balance).

Second, create a text file that contains the whole dollar customer payment amount values (315, 451, 315, 374, 353, 315, 450, 484, 412, 315, 495, 476, 321, 315, 406, 329, 326, 356, 315, 325).

Finally, create a CarLoanClient class that:

a. Creates a "CarLoan" class object, named "cl01".

b. Read the customer payment values from the text file, one payment at a time. Include the use of exception handling during the reading of the text file values, exception handling code, "IllegalPaymentAmountException", that displays the following string to the user, "Invalid payment amount. Please enter valid payment amount > ", and allows the user to manually enter a payment amount.

c. Passes the payment values read from the text file to a method that calculates the outstanding balance. (Hint: Use the withdrawal method).

d. Outputs the following for each payment amount value:

- A payment sequence number, starting at "1" and ending at "20";
- The payment amount value that corresponds to the appropriate payment number, and;
- The outstanding loan balance, after the application of the corresponding payment amount value.

e. Processes each payment amount value Continues to process each payment amount value until the end of the file is reached.

import java.text.DecimalFormat;

public class BankAccount
{
public final DecimalFormat MONEY = new DecimalFormat("$#,##0.00");
public double balance;

//Default Constructor: Sets balance to 0.0.
public BankAccount()
{
balance = 0.0;
}

/*
Overloaded Constructor
@param startBalance beginning balance
*/
public BankAccount( double startBalance )
{
deposit( startBalance );
}

/*
Accessor for Balance
@return current account balance
*/
public double getBalance()
{
return balance;
}

/*
Deposit amount to account.
@param amount amount to deposit;
amount must be >= 0.0
*/
public void deposit(double amount)
{
if( amount >= 0.0)
balance += amount;
else
System.err.println( "Deposit amount must be positive and cannot be"
+ "greater than the balance." );
}

/*
Withdraw amount to account.
@param amount amount to withdraw;
amount must be >= 0.0
amount must be <= balance
*/
public void withdraw(double amount)
{
if( amount >= 0.0 && amount <= balance)
balance -= amount;
else
System.err.println( "Withdrawal amount must be positive and cannot "
+ " be greater than the balance." );
}

/*
toString
@return the balance formatted as money.
*/
public String toString()
{
return ( "Balance is > " + MONEY.format( balance ) );
}
}

Reference no: EM131567060

Questions Cloud

What is the maximum amount of compound interest : Find the effective rate corresponding to an annual rate of 10% compounded continuously.
Describe how the brain has been implicated in schizophrenia : Describe how the brain has been implicated in schizophrenia
President of marketing for sharpco manufacturing : Brian Charles, the vice president of marketing for Sharpco Manufacturing, commented at the weekly executive directors' meeting, "I have good news.
How much should you have deposited in a bank account : A sum of $12 000 is invested at 4% annual interest. What will this amount have grown to after 15 years?
Creates a carloan class object : Creates a CarLoan class object, named cl01. Create a text file that contains the whole dollar customer payment amount values.
What does a consumer need to access it : Where is it used? Found? What does a consumer need to access it? How is it used? When is it used? What are the costs associated with use
Which terms are preferable for a borrower : Which terms are preferable for a borrower: an annual interest rate of 21.5%, with interest paid yearly.
A qualitative and longitudinal study of the daily mobility : A qualitative and longitudinal study of the daily mobility of the elderly
New systems that may be implement : What are the costs of the new systems that may be implement? How do we justify their implementation at Cango?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Design and implement your own simple class to represent

Design and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...) Your class should have a constructor, one additional method and at least one member variable (e.g. boolean isOn to turn th..

  Explain the importance of programming style concepts

The assignment task consists of implementing a tool which would assist the manager of a small company in scheduling employees -  Explain the importance of programming style concepts

  Create a servlet that displays a form when the doget method

Create a Servlet that displays a form when the doGet method is invoked. The form will contain a post action that directs the form post back to the same servlet, which in the doPost method will append the form data to a random access file. After th..

  Java program that prompts the user to input an integer

Write a Java program that prompts the user to input an integer and then outputs both the individual digits of the number and the sum of the digits.

  The program should ask the user to enter the student'' answer

Your program should store these correct answers in an array. (Store each question's correct answer in an element of a string array.) the program should ask the user to enter the student's answers for each of the 20 questions, which should be stored i..

  History of java

Add a class FillInQuestion to the question hierarchy of How To 10.1. An object of this class is constructed with a string that contains the answer, surrounded by _ _, for example, "The inventor of Java was _James Gosling_". The question should be ..

  N is perfect number or not

Prepare a Program to find whether the given no. N is perfect number or not.

  Develop a solution for bookstore inventory management system

Develop an object oriented solution for Bookstore Inventory Management System. Identify the necessary objects and actions that are required to produce your solutions.

  Write a java program using classes and object

Use different program control statements in a programming language and demonstrate the use of arrays with a programming language and Define and work with classes and objects in a programming language.

  Write a program with an exception handler

Write a program with an exception handler that deals with nonnumeric operands; then write another program without using an exception handler to achieve the same objective.

  What access modifier do you use to restrict access

Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?

  A method that takes a two-dimensional array

A method that takes a two-dimensional array of int's as a parameter and searches the array for the second parameter, returning true if the second parameter matches any of the integers in the array, and false otherwise.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd