Ch3 classwork notes

Ch3 classwork notes - Ch3 classwork notes 1. import...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Ch3 classwork notes 1. import javax.swing.JOptionPane; public class BankAccount { private double balance ; public BankAccount() // default constructor { balance =0; } public BankAccount( double iniBal) //mutator constructor { balance = iniBal; } public void deposit( double amt) { balance = balance + amt; } public void withdraw( double amt) { balance = balance - amt; } public double getBalance() { return balance ; } public void display() { String message= "The balance is " + balance ; JOptionPane. showMessageDialog ( null , message); } } 2. public class useBankAccount { public static void main(String[] args) { BankAccount Laura = new BankAccount(); BankAccount Christina = new BankAccount(1000); Laura. deposit(500); Christina. deposit(1000); Laura.withdraw(500); Christina.withdraw(200); Laura.display(); Christina.display(); } }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3. student.java public class student { private String id ; private String name ; private double gpa ; public student() // default constructor { id = "AAAA" ; name = "Jane Doe"
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/07/2010 for the course JAVA 153 taught by Professor Silou during the Spring '10 term at Golden West College.

Page1 / 5

Ch3 classwork notes - Ch3 classwork notes 1. import...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online