1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Stels [109]
3 years ago
13

Write a C program that will update a bank balance. A user cannot withdraw an amount ofmoney that is more than the current balanc

e. The current balance must always be non-negativevalue. The variable types must be selected wisely. A sample run is below. The user’s response is in boldface (C by discovery)BANK ACCOUT PROGRAM!----------------------------------Enter the old balance: 1234.50Enter the transactions now.Enter an F for the transaction type when you are finished.Transaction Type (D=deposit, W=withdrawal, F=finished): DAmount: 568.34Transaction Type (D=deposit, W=withdrawal, F=finished): WAmount: 25.68Transaction Type (D=deposit, W=withdrawal, F=finished): WAmount: 167.40Transaction Type (D=deposit, W=withdrawal, F=finished): FYour ending balance is $1609.76Program is ending

Engineering
1 answer:
GarryVolchara [31]3 years ago
5 0

Answer:

Explanation:

Sample output:

BANK ACCOUT PROGRAM!

----------------------------------

Enter the old balance: 1234.50

Enter the transactions now.

Enter an F for the transaction type when you are finished.

Transaction Type (D=deposit, W=withdrawal, F=finished): D

Amount: 568.34

Transaction Type (D=deposit, W=withdrawal, F=finished): W

Amount: 25.68

Transaction Type (D=deposit, W=withdrawal, F=finished): W

Amount: 167.40

Transaction Type (D=deposit, W=withdrawal, F=finished): F

Your ending balance is $1609.76

Program is ending

Code to copy:

// include the necessary header files.

#include<stdio.h>

// Definition of the function

float withdraw(float account_balance, float withdraw_amount)

{

// Calculate the balace amount.

float balance_amount = account_balance - withdraw_amount;

// Check whether the withdraw amount

// is greater than 0 or not.

if (withdraw_amount > 0 && balance_amount >= 0)

{

// Assign value.

account_balance = balance_amount;

}

// return account_balance

return account_balance;

}

// Definition of the function deposit.

float deposit(float account_balance, float deposit_amount)

{

// Check whether the deposit amount is greater than zero

if (deposit_amount > 0)

{

// Update account balance.

account_balance = account_balance + deposit_amount;

}

// return account balance.

return account_balance;

}

int main()

{

// Declare the variables.

float account_balance;

float deposit_amount;

float withdrawl_amount;

char input;

// display the statement on console.

printf("BANK ACCOUT PROGRAM!\n");

printf("----------------------------------\n");

// prompt the user to enter the old balance.

printf("Enter the old balance: ");

// Input balance

scanf("%f", &account_balance);

// Display the statement on console.

printf("Enter the transactions now.\n");

printf("Enter an F for the transaction type when you are finished.\n");

// Start the do while loop

do

{

// prompt the user to enter transaction type.

printf("Transaction Type (D=deposit, W=withdrawal, F=finished): ");

// Input type.

scanf(" %c", &input);

// Check if the input is D

if (input == 'D')

{

// Prompt the user to input amount.

printf("Amount: ");

// input amount.

scanf("%f", &deposit_amount);

// Call to the function.

account_balance=deposit(account_balance,deposit_amount);

}

// Check if the input is W

if (input == 'W')

{

printf("Amount: ");

scanf("%f", &withdrawl_amount);

// Call to the function.

account_balance = withdraw(account_balance,withdrawl_amount);

}

// Check if the input is F

if (input == 'F')

{

// Dispplay the amount.

printf("Your ending balance is $%.2f\n", account_balance);

printf("Program is ending\n");

}

// End the while loop

} while(input != 'F');

return 0;

}

the picture uploaded below shows the program screenshot.

cheers, i hope this helps.

You might be interested in
Consider an area-source box model for air pollution above a peninsula of land. The length of the box is 15 km, its width is 80 k
In-s [12.5K]

Consider an area-source box model for air pollution above a peninsula of land. The length of the box is 15 km, its width is 80 km, and a radiation inversion restricts mixing to 15 m. Wind is blowing clean air into the long dimension of the box at 0.5 m/s. On average, there are 250,000 vehicles on the road, each being driven 40 km in 2 hours and each emitting 4 g/km of CO.

Required:

a. Estimate the steady-state concentration of CO in the air. Should the city be designated as "nonattainment" (i.e., steady-state concentration is over the NAAQS standard)?

b. Find the average rate of CO emissions during this two-hour period.

c. If the windspeed is zero, use the formula to derive relationship between CO and time and use it to find the CO over the peninsula at 6pmConsider an area-source box model for air pollution above a peninsula of land. The length of the box is 15 km, its width is 80 km, and a radiation inversion restricts mixing to 15 m. Wind is blowing clean air into the long dimension of the box at 0.5 m/s. On average, there are 250,000 vehicles on the road, each being driven 40 km in 2 hours and each emitting 4 g/km of CO.

Required:

a. Estimate the steady-state concentration of CO in the air. Should the city be designated as "nonattainment" (i.e., steady-state concentration is over the NAAQS standard)?

b. Find the average rate of CO emissions during this two-hour period.

c. If the windspeed is zero, use the formula to derive relationship between CO and time and use it to find the CO over the peninsula at 6pmConsider an area-source box model for air pollution above a peninsula of land. The length of the box is 15 km, its width is 80 km, and a radiation inversion restricts mixing to 15 m. Wind is blowing clean air into the long dimension of the box at 0.5 m/s. On average, there are 250,000 vehicles on the road, each being driven 40 km in 2 hours and each emitting 4 g/km of CO.

Required:

a. Estimate the steady-state concentration of CO in the air. Should the city be designated as "nonattainment" (i.e., steady-state concentration is over the NAAQS standard)?

b. Find the average rate of CO emissions during this two-hour period.

c. If the windspeed is zero, use the formula to derive relationship between CO and time and use it to find the CO over the peninsula at 6pm

<em><u>p</u></em><em><u>lease</u></em><em><u> mark</u></em><em><u> me</u></em><em><u> as</u></em><em><u> brainliest</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

<em><u>f</u></em><em><u>ollow</u></em><em><u> me</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>,</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

3 0
3 years ago
The input and output signals of a system is related by the following equation: fraction numerator d squared y over denominator d
Colt1911 [192]

Answer:

Explanation:

The given equation is :

\frac{d^{2}y }{dx^{2} } + sin(3y) \frac{dy}{dt} + y = t\frac{df}{dt} + f

5 0
3 years ago
help me please help me please help me please help me please help me please help me please help me please help me please help me
kakasveta [241]

Answer:

With what?

Explanation:

Brainliest?

7 0
3 years ago
Read 2 more answers
Koch traded Machine 1 for Machine 2 when the fair market value of both machines was $60,000. Koch originally purchased Machine 1
Mariana [72]

Answer:

Koch's adjusted basis in machine 2 after the exchange is $60,000

Explanation:

given data

fair market value = $60,000

originally purchased Machine 1 = $76,900

Machine 1 adjusted basis = $40,950

Machine 2 seller purchase = $64,050

Machine 2 adjusted basis = $55,950

solution

As he exchanged machine for another at $60,000

and this exchanged in fair market

so adjusted basis =  $50,000

Adjusted basis is the price of the item that affects the factors that are considered price. These factors usually include taxes, depreciation value, and other costs of acquiring and maintaining a given item. Adjusted basis is important so the right amount to sell

Adjusted basis increases when a person deducts expenses from factor taxes and operating statements

so Koch's adjusted basis in machine 2 after the exchange is $60,000

3 0
3 years ago
What is the minimum efficiency of a functioning current-model catalytic converter? a. 60% b. 75% c. 80% d. 90%
slamgirl [31]

Answer:

d. 90%

Explanation:

As we know that internal combustion engine produce lot's of toxic gases to reduce these toxic gases in the environment a device is used and this device is know as current modeling converter.

Generally the efficiency of current model catalytic converter is more than 90%.But the minimum efficiency this converter is 90%.

So option d is correct.

d. 90%

7 0
3 years ago
Other questions:
  • A strain gauge with a 5 mm gauge length gives a displacement reading of 1.25 um. Calculate the stress value given by this displa
    15·1 answer
  • A hydrogen-filled balloon to be used in high altitude atmosphere studies will eventually be 100 ft in diameter. At 150,000 ft, t
    7·1 answer
  • The solid cylinders AB and BC are bonded together at B and are attached to fixed supports at A and C. The modulus of rigidity is
    6·1 answer
  • Single point cutting tool removes material from a rotating work piece to generate a cylinder is called • Facing Tuming • Both 1
    6·1 answer
  • Explain why you chose the final design of your prototype and how it solved the identified need
    9·1 answer
  • In science, a force is a push or a pull.<br> is it true or false ?
    5·1 answer
  • Four subjects civil engineers need to study​
    12·1 answer
  • Describe the engineering design process in your own words.
    6·2 answers
  • The difference in potential energy between an electron at the negative terminal and one at the positive terminal is called the _
    11·1 answer
  • ما سبب نزول الاية
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!