5. Complete the following tasks: a. Design a class named CHECKINGACCOUNT that ho
ID: 3687334 • Letter: 5
Question
5. Complete the following tasks:
a. Design a class named CHECKINGACCOUNT that holds a checking account number, name of account holder, and balance. Include mthods to set values for each data field and a method that displays all the account information. Create the class diagram and write the pseudocode that defines the class.
b. Design an application that declares two CHECKINGACCOUNT objects and sets and displays their values
c. Design an application that declares an array of five CHECKINGACCOUNT objects. Prompt the user for data for each object, and then display all the values.
Explanation / Answer
Class Diagram: CheckingAccount
accountNo:num
name:string
balance:num
setAccountNo(no:num) : void
setName(name:string) :void
setBalance(balance:num):void
dispay():void
Pseudocode for checkingAccount:
class CheckingAccount
private num accountNo
private string name
private num balance
public void setAccountNo(no:num)
accountNo=no
public void setName(name:string)
this.name=name
public void setBalance(balance:num)
this.balance=balance
public void dispay(CheckingAccount acct)
print "Account Number: " ,acct.accountNo
print "Account Holder Name: " ,acct.name
print "Account Balance: " ,acct.balance
endClass
Question 2:
Start
CheckingAccount account1
CheckingAccount account2
account1.setName("Raj")
account1.setAccountNo(12345)
account1.setBalance(20000)
display(account1)
account1.setName("Simran")
account1.setAccountNo(12346)
account1.setBalance(10000)
display(account2)
end
Question 3:
Start
CheckingAccount account[5]
for(i=0;i<5;i++)
String name
int no
double bal
print "Enter account name"
input name
print "Enter accunt balance"
input bal
print "Enter account no"
input no
account[i].setName(name)
account[i].setBalance(bal)
account[i].setAcctNo(no)
end for
for(i=0;i<5;i++)
display(account[i])
end for
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.