Declare the balance as a global variable

Assignment Help Basic Computer Science
Reference no: EM131427255

Write a C program to simulate deposit/withdraw activities on a banking account. (Hint: you might want to review Lab 3 slides.)

  • Declare the balance as a global variable and initialize it to 600.
  • Write two functions, one for withdraw, the other for deposit. Both withdraw and deposit functions have one parameter, which represent the amount to withdraw or deposit. The functions deduct the balance and add to the balance one dollar at a time, respectively. Therefore, to withdraw 600 thousands, for example, the withdraw function has to execute a loop with 600 thousand iterations. The deposit function works in the same way, in the reverse direction.
  • Create two Posix threads in main(), which call the withdraw and the deposit function respectively.
  • Use pthread_mutex_lock() and pthread_mutex_unlock() functions to ensure mutual exclusion between the two threads. Also make sure to use pthread_join() to wait for the threads to terminate.

Reference no: EM131427255

Questions Cloud

Compute comprehensive income : Classify each transaction as operating, investing, or financing and then prepare an income statement.
Database application development : Two of the most important variables that determine the success of a web form is the form design and form field validation. Think about some web forms you might have completed online recently, such as the FAFSA form to receive financial aid, or you..
Calculate the mean and the standard deviation : Calculate the mean and the standard deviation for the percentage of seats in parliament held by women in these states and interpret your results
Designing secure software : Security cannot be an added afterthought or a half measure. This approach is likely to cause more trouble than doing nothing for system security. Please respond to all of the following prompts:
Declare the balance as a global variable : Write a C program to simulate deposit/withdraw activities on a banking account. (Hint: you might want to review Lab 3 slides.) Declare the balance as a global variable and initialize it to 600.
According to tom bethell, devout religious people tend to : According to Jim Thomas, Eric Hoffman, and Jaydee Hanson, which of the following biofuels sources uses the most water and energy and has the greatest greenhouse gas emissions?According to Jim Thomas, Eric Hoffman, and Jaydee Hanson, pursuing the p..
Describe the infrastructure of cell phone networks : Discussion- Describe the infrastructure of cell phone networks. Explain the importance of IT for nonprofit organizations.
Internet access for security purposes : Take a position on the ethical concerns raised by employees who are upset about organizations monitoring their email or Internet access for security purposes. Assess whether you believe it is fair for an employee to undergo this type of surveillan..
Difference between net profit and comprehensive income : On which financial statement could you find a reconciliation of the beginning and ending balances of comprehensive income (or total recognized income and expense) for a given period of time?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd