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

A pair of transactions T and U are operating on bank accounts A, B, and C whose

ID: 3595563 • Letter: A

Question

A pair of transactions T and U are operating on bank accounts A, B, and C whose
initial balances are $600, $400, and $500 respectively. Transaction T transfers
$200 each from accounts A, and C to account B. Transaction U increases the
current balance of Account B by 25% to make it $1000. Transaction U deposits
$300 to Account C so that the balance is $600. So the final balances of accounts
are Account A: $400, Account B (bal1): $1000, and Account C (bal2): $600.

Provide a serially equivalent interleaving of the transactions T and U that will
produce the correct values for bal1 and bal2

Transaction T: Transaction U: a.withdraw (200);
b.deposit(200);
c.withdraw (200);
b.deposit (200); balance = b.getbalance();
b.setbalance(balance* 1.25)
c.deposit( 300);
bal1 = b.getbalance();
bal2 = c.getbalance();

Explanation / Answer

Serially Equivalent Transaction

a.withdraw(200)   

b.deposit(200)

c.withdraw(200)

b.deposit(200)

balance = b.getbalance()

b.setbalance(balance * 1.25)

c.deposit(300)

bal1 = b.getbalance()

bal2 = c.getbalance()

$ 200 are withdrawn from account a and c and deposited in b in Transaction T

a = $400

b = $600

c = $300

b = $800

Now Transaction U executes

balance = 800

b = 800 * 1.25 = 1000

c = 300+ 300 = 600

bal1 = 1000

bal2 = 600

Transaction T : Transaction U

a.withdraw(200)   

b.deposit(200)

c.withdraw(200)

b.deposit(200)

balance = b.getbalance()

b.setbalance(balance * 1.25)

c.deposit(300)

bal1 = b.getbalance()

bal2 = c.getbalance()

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