Account

Account - return amount/Mutators of name and amount public...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Assignment #: 6 // Name: // StudentID: // Lecture: // Description: The class Account represents an account of some bank, // with its name and balance amount. / import java.text.NumberFormat; i public class Account { private String name; private double amount; //Constructor to initialize all member variables public Account(String aName, double someAmount) { name = aName; amount = someAmount; } //Accessors of name and amount public String getName() { return name; } public double getAmount()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return amount; } //Mutators of name and amount public void setName(String aName) { name = aName; } public void setAmount(double someAmount) { amount = someAmount; } //toString() method returns a string containg the name and amount of the account public String toString() { NumberFormat money = NumberFormat.getCurrencyInstance(); String result = name + ": " + money.format(amount); return result; } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online