Bank.java - Assignment 4 Name Brandon Benich StudentID 1205823810 Lecture T TH 3-4:15pm Time Spent 15 minutes*Description This class is used to get and

Bank.java - Assignment 4 Name Brandon Benich StudentID...

This preview shows page 1 out of 1 page.

/* Assignment #: 4 Name: Brandon Benich StudentID: 1205823810 Lecture: T TH 3-4:15pm Time Spent: 15 minutes *//**Description: This class is used to get and set the bank's name and ID. It also accesses Address.java to set address. *//* */ public class Bank { private String bankName; private String bankID; private Address bankAddress; public Bank(){ // Constructor bankName = "?"; bankID = "?"; bankAddress = new Address(); // Create new instance of bankAddress } public String getBankName(){ // Method to get the Bank's name. It is not used by the program at all... return bankName; } public String getBankID(){ // Method to get the Bank's ID. It is not used by the program at all... return bankID; } public Address getBankAddress(){ // Method to get the Bank's Address. It is not used by the program at all... return bankAddress; } public void setBankName(String NewName){ // Method to SET the Bank's name. bankName = NewName; } public void setBankID(String NewID){ // Method to SET the Bank's ID. bankID = NewID; } public void setBankAddress(String newCity, String newState){ // Method that accesses Address.java to SET the Bank's Address. bankAddress.setCity(newCity); bankAddress.setState(newState); } public String toString(){ // Method to return the Bank's information to be displayed to the user. return ("\nBank name:\t\t"+bankName+"\nBank ID:\t\t"+bankID+"\nBank address:\t\t"+bankAddress.toString()+"\n\n"); // Output String } }

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture