Exercise6Chp4Solut

Exercise6Chp4Solut - Account Name “Paul Johnson”...

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

View Full Document Right Arrow Icon
Name________________________ CSE182 1 CSE 182 Exercise #6 (Chapter 4) Solution 1. Given the Account.cs class, write code to finish the following task (1) Create an account called acct1 by calling the null body constructor Account acct1 = new Account( ); (2) Set acct1’s name to “Mary Smith”, account number to 12345 acct1.acctName = Mary Smith ; (3) Deposit $1,500 into acct1. acct1.Deposite(1500.00); (4) Print acct1’s info. on screen Console.WriteLine(acct1); (5) Create another account called acct2 by calling the overloaded constructor, initialize acct2 with the following information
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Account Name: “Paul Johnson” Account Number: 90123 Account Balance: $15,325.75 Account acct2 = new Account(90123, “ Paul Johnson ” , 15325.75); (6) Allow Paul to withdraw $5,000.00 from his account acct2.Withdraw(5000.00); (7) Write code to just print Paul Johnson’s new account balance Console.WriteLine( “ Paul Johnson\ ’ s current account balance is: {0:c} ” , acct2.AcctBalance); (8) Change acct2’s name from “Paul Johnson” to “Amy Johnson”. acct2.AcctName = “ Amy Johnson ” ; (9) Print acct2’s info. on screen Console.WriteLine(acct2);...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online