Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Examine the object diagram shown at right. If this diagram represents the state

ID: 3824212 • Letter: E

Question

Examine the object diagram shown at right. If this diagram represents the state of memory before the following statements are executed, what are the values of x and y after the statements are executed? How is the object diagram changed by these statements?

fred.deposit( 150 );
double x = barney.getBalance();
double y = fred.getBalance();

fred.deposit( 150 );
double x = barney.getBalance();
double y = fred.getBalance();

fred barney String BankAccount Flintstone Owner String acctID "12345M" balance 625 String BankAccount owner a Rubble acctID String balance 1000 08964G

Explanation / Answer

The values of x and y are :-

x= 1000;

y=775

By these statements , the only change in that object diagram is the value of balance in the fred object.The value is changed to 775 from 625

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote