tut03_2009_r1 - EE3206/EE5805 Java Programming and...

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

View Full Document Right Arrow Icon
EE3206/EE5805 Java Programming and Applications Tutorial 3 – Programming with Objects and Classes 1. What will be displayed if the following code is compiled and executed? Indicate the errors and suggest amendments, if any. public class CreditCardStatement { final static float INIT_BALANCE = 100.00; private String accountNumber = "xxxx-000-000"; private float statementBalance = INIT_BALANCE; public static void main(String[] args) { printStatement(); } public void printStatement() { System.out.println("STATEMENT OF HSBC VISA CARD ACCOUNT"); System.out.println("Account number: " + accountNumber); System.out.println("Statement Balance: " + statementBalance); } } 2. What will be displayed if the following code is compiled and executed? Indicate the errors and suggest amendments, if any. public class TestCreditCardStatement { public static void main(String[] args) { CreditCardStatement[] statements = new CreditCardStatement[3]; for(int i=0; i<3; i++) statements[i].printStatement(); } }
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. To apply object-orientation in program design, try to model a simple bank account
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.

Page1 / 3

tut03_2009_r1 - EE3206/EE5805 Java Programming and...

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