This project will have two classes: A test class and a Bank Account class. Construct the Bank
Question:
This project will have two classes: A test class and a Bank Account class.
- Construct the Bank Account class by pasting the following code into BlueJ:
public class BankAccount
{
public BankAccount (String nm, Double amt)
{
name=nm;
balance=amt;
}
public void deposit (double dp)
{
balance=balance + dp;
}
public void withdraw (double wd)
{
balance=balance-wd;
}
public void setName(String n)
{
name = n;
}
public void setBalance(double b)
{
balance = b;
}
public String getName()
{
return name;
}
public double getBalance()
{
return balance;
}
private String name;
private double balance;
}
- Construct a tester class that provides a loop that lets you enter several BankAccount objects. As each is entered, it will be added to the ArrayList object. After several accounts have been entered, a loop will step through each BankAccount object in the ArrayList and decide which account has the largest balance that will then be printed.
Following is the output screen after a typical run:
Please enter the name to whom the account belongs ("Exit" to abort) Jim Jones
Please enter the amount of the deposit. 186.22
Please enter the name to whom the account belongs ("Exit" to abort) Bill Gates
Please enter the amount of the deposit. 102.15
Please enter the name to whom the account belongs ("Exit" to abort) Helen Hunt
Please enter the amount of the deposit. 1034.02
Please enter the name to whom the account belongs ("Exit" to abort) Charles Manson
Please enter the amount of the deposit. 870.85
Please enter the name to whom the account belongs ("Exit" to abort) exit
The account with the largest balance belongs to Helen Hunt.
The amount is 1034.02.
Assignment 2:
The DistrictList class represent a List of Team objects. The Team class and DistrictList class are described below:
public class Team {
private String name;
private int wins;
private int losses;
//There may be instance variables, constructors, and methods that are not shown here.
/*Part a, calcWinRatio() * Returns the ratio of wins to games played, or -1 if no games have been played. * (example if wins is 6 and losses are 4, calcWinRatio() returns 0.6) *Precondition: wins and losses are both greater than or equal to 0 *Postcondition: no instance variables are changed */
pubic double calcWinRatio() {
//to be coded for part a
}
}
Public class DistrictList {
private ArrayList teamList;
//There may be instance variables, constructors, and methods that are not shown here.
/*Part b, getPlayoffTeams(double cutOffRatio) * Removes all teams from the list that have a Win Ratio that meets or exceeds the cutOffRatio. * Returns an Arraylist containing the teams removed, or null if no teams meet the criteria. * Assume that calcWinRatio() works correctly regardless of what you coded in part a. * You must use calcWinRatio() in your solution to get full credit. *PreCondition: teamList will not be empty *PostCondition: teamList will only contain the teams that did not * meet or exceed the cutOffRatio. */
public ArrayList getPlayoffTeams(double cutOffRatio) {
//to be coded for part b
}
}
Part a.
pubic double calcWinRatio() {
}
Part b.
public ArrayList getPlayoffTeams(double cutOffRatio) {
} *Could someone please answer both assignments? For each assignment header is a set questions and a set of directions, please follow all the questions and direction, and please make sure all of the code is your own work and NOT from online so that it helps me understand better*
Contemporary Financial Management
ISBN: 9780324289114
10th Edition
Authors: James R Mcguigan, R Charles Moyer, William J Kretlow