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

  Various racial and ethnic categories

1. Why do various racial and ethnic categories of the U.S. population have different social standing? 2. How well informed were you regarding end of life care before taking this course?

  Concept of an association related to that of mobility

How is the concept of an association related to that of mobility? Is a distribution system a wireless network? Discuss and support your claim.

  Estimate the heat transfer coefficient for liquid sodium

The entering velocity is 2 ft/s, based on the area of the shell, and the tube surface temperature is 400°F. The outlet sodium temperature is 600°F.

  Hexadecimal and binary value of the given number

What is its value in hexadecimal if the integer is converted to a 32 bit integer - Find the decimal, hexadecimal and binary value of the given number.

  Solve the maximum flow problem by the labeling algorithm

Specify the residual network before each augmentation. After every augmentation, decompose the flow into flows along directed paths from node s to node t. Finally, specify the minimum cut in the network obtained by the labeling algorithm.

  Implement the counter using d flip-flops

Assume that only 2-input NAND, NOR, XOR, and XNOR gates are available. Draw the schematic for your minimum gate count implementation.

  Write a java program which reads a text file

1. Write a Java program which reads a text file called mydata.txt containing the following numbers: 34 56 76 98 12 33 58 42 98 93 and computes the minimum, maximum sum and average of the numbers and puts the output in a file called myresults.txt.

  Locations that employ windows server

Directory Services word-2-3 pages and a 5 slide power point presentation. You manage 3 locations that employ Windows Server 2012. You want to take measures to reduce the risk of failure. To achieve this, you must consider doing the following:

  Create an array of integers 10 elements long

Create an array of integers 10 elements long. ? Loop through this array (using its length value), assigning a random value between 0 and 100 (inclusive) to each element. Remember: random(100) returns a float and will never return 100.0.

  Human-computer interaction environments

Evaluate interface design models and describe design issues across human-computer interaction environments associated with these models. Support your response.

  Assess and evaluate key aspects of legal

Identify ethical, social and legal issues relevant to Information Systems within a context of application and assess and evaluate key aspects of legal, ethical and cultural issues relevant to an IT professional

  Budgeted cost of work performed

Note: BCWS (budgeted cost of work scheduled), BCWP (budgeted cost of work performed), ACWP (actual cost of work performed), SV (schedule variance), CV (cost variance), EAC (estimate at completion), BAC (budget at completion; baseline cost), CPI (c..

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