1. Homepage
  2. Programming
  3. CS350 Fundamentals of Computing Systems - Assignment 2 - Bank Transactions

CS350 Fundamentals of Computing Systems - Assignment 2 - Bank Transactions

Engage in a Conversation
BUCS350Fundamentals of Computing SystemsGOBank Transactions

Assignment 2 - Bank Transactions

Due Date: Fri, 9 Feb, 2024 CourseNana.COM

Please make sure to regularly commit and push your work to Gitlab so that we can see your progress. Final submission will be on Gradescope – this will be the only source of truth for grading. CourseNana.COM

There will be no late submission and no extensions, so make sure to submit on time. CourseNana.COM

Introduction

Correctness of data is very important in real world applications such as banking. An ideal bank should be able to handle millions of requests for various accounts simultaneously, whilst ensuring that all user data is correct. CourseNana.COM

Some common tasks that all banking applications have to handle are: CourseNana.COM

  • Create account
  • Deposit funds
  • Withdraw funds
  • Transfer funds

In this assignment, you are given a codebase with some parts of a banking application implemented. Some parts of the code are not implemented and some might be buggy. Your task is to implement the missing code, and fix any possible bugs in the code. CourseNana.COM

Code Overview and Objectives

All code for this assignment resides in bank.go CourseNana.COM

You are provided with the following structs for defining a bank and accounts within it: CourseNana.COM

type Bank struct {
    bankLock *sync.RWMutex
    accounts map[int]*Account
}

type Account struct {
    balance int
    lock    *sync.Mutex
}

You need to ensure that the following methods are implemented correctly: CourseNana.COM

  • CreateAccount()
  • Deposit()
  • Withdraw()
  • Transfer()
  • [BONUS!] DepositAndCompare()

Your code’s execution should be deterministic. The tester will make a huge number of concurrent calls to your code, and running the exact same input multiple times should not affect the final state of the Bank or any of the Accounts within it. CourseNana.COM

Your code should also be able to handle errors such as handling account ids that dont exist or are being duplicated by throwing an error. In such cases, your code needs to log appropriate error messages. CourseNana.COM

DPrintf

We also provide you with a function called DPrintf(). It is similar to Printf, but you can set CourseNana.COM

const Debug = false

to disable the DPrintf() statements, which may help you debug your code. CourseNana.COM

It is set to true by default. Using DPrintf is optional, but recommended for ease of coding. CourseNana.COM

Instructions

  1. Clone the repository and navigate to the bank directory.
  2. Put your code in the appropriate methods/files.
  3. Run the tests
    1. go test -v -race
    2. You should ensure that you the entire test suite works multiple times, ie. try running the tests at least 5 times successfully.
  4. Upload the bank.go file to Gradescope. Do not change the file name, or the autograder may not recognize it.

Your output should be something like this CourseNana.COM

go test -v -race

=== RUN   TestCreateAccountBasic
--- PASS: TestCreateAccountBasic (0.00s)
=== RUN   TestCreateAccountMany
--- PASS: TestCreateAccountMany (0.00s)
=== RUN   TestManyDepositsAndWithdraws
--- PASS: TestManyDepositsAndWithdraws (3.57s)
=== RUN   TestFewTransfers
--- PASS: TestFewTransfers (0.00s)
=== RUN   TestManyTransfers
--- PASS: TestManyTransfers (0.00s)
=== RUN   TestDepositAndCompare
--- PASS: TestDepositAndCompare (0.01s)
PASS
ok      cs350/bank-transactions 4.771s

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
BU代写,CS350代写,Fundamentals of Computing Systems代写,GO代写,Bank Transactions代写,BU代编,CS350代编,Fundamentals of Computing Systems代编,GO代编,Bank Transactions代编,BU代考,CS350代考,Fundamentals of Computing Systems代考,GO代考,Bank Transactions代考,BUhelp,CS350help,Fundamentals of Computing Systemshelp,GOhelp,Bank Transactionshelp,BU作业代写,CS350作业代写,Fundamentals of Computing Systems作业代写,GO作业代写,Bank Transactions作业代写,BU编程代写,CS350编程代写,Fundamentals of Computing Systems编程代写,GO编程代写,Bank Transactions编程代写,BUprogramming help,CS350programming help,Fundamentals of Computing Systemsprogramming help,GOprogramming help,Bank Transactionsprogramming help,BUassignment help,CS350assignment help,Fundamentals of Computing Systemsassignment help,GOassignment help,Bank Transactionsassignment help,BUsolution,CS350solution,Fundamentals of Computing Systemssolution,GOsolution,Bank Transactionssolution,