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
Make two lists of applications of matrices, one for those that require jagged matrices and one for those that require rectangula
Agata [3.3K]

Answer:

Explanation:

You can utilize barbed clusters to store inadequate grids. On the off chance that there are a great many lines yet each line has just 4 or 5 associations with different segments, at that point as opposed to utilizing a 1000x1000 cluster you can utilize a 1000 line rough exhibit while you simply store the components that the present section has association with another segment. Other utilization can be done on account of query tables. Query tables will be tables which have different qualities concerning a solitary key where the quantity of qualities isn't fixed. Aside from this, barbed clusters have an exceptionally set number of utilization cases. Multidimensional exhibits then again have plenty of utilizations. It is utilized to store a great deal of information reliably on the grounds that the greater part of the information is put away is steady concerning which section compares to what information. Aside from that it very well may be utilized to make thick diagrams or sparse(not effective), plotting information. Another utilization case would be used as an impermanent stockpiling for the figurings that need to tail them and utilize the past information like in powerful programming.

3 0
3 years ago
When they say in the United States that a car’s tire is filled “to 32 lb,”​ they mean that <br>its internal pressure is 32 lbf/i
arsen [322]

Answer:

0.71 lbf

Explanation:

Use ideal gas law:

PV = nRT

where P is absolute pressure,

V is volume,

n is number of moles,

R is universal gas constant,

and T is absolute temperature.

The absolute pressure is the sum of the atmospheric pressure and the gauge pressure.

P = 32 lbf/in² + 14.7 lbf/in²

P = 46.7 lbf/in²

Absolute temperature is in Kelvin or Rankine:

T = 75 + 459.67 R

T = 534.67 R

Given V = 3.0 ft³, and R = 10.731 ft³ psi / R / lb-mol:

PV = nRT

(46.7 lbf/in²) (3.0 ft³) = n (10.731 ft³ psi / R / lb-mol) (534.67 R)

n = 0.02442 lb-mol

The molar mass of air is 29 lbm/lb-mol, so the mass is:

m = (0.02442 lb-mol) (29 lbm/lb-mol)

m = 0.708 lbm

The weight of 1 lbm is lbf.

W = 0.708 lbf

Rounded to two significant figures, the weight of the air is 0.71 lbf.

3 0
2 years ago
In wet mill ethanol plants, a total energy of 74,488 Btu (British thermal units, a common energy unit) is used to produce 1 gall
V125BC [204]

Answer:

The energy yield for one gallon of ethanol is 2.473 %.

Explanation:

The net energy yield (\% e), expressed in percentage for one gallon of ethanol is the percentage of the ratio of the difference of the provided energy (E_{g}), measured in Btu, and the energy needed to produce the ethanol (E_{p}), measured in Btu, divided by the energy needed to produce the ethanol. That is:

\% e =\frac{E_{g}-E_{p}}{E_{p}} \times 100\,\% (1)

If we know that E_{g} = 76330\,Btu and E_{p} = 74488\,Btu, then the net energy yield of 1 gallon of ethanol:

\%e = \frac{76330\,Btu-74488\,Btu}{74488\,Btu}\times 100\,\%

\%e = 2.473\,\%

The energy yield for one gallon of ethanol is 2.473 %.

4 0
3 years ago
An interest rate of norminal 12% per year , compounded weekly is
AlexFokin [52]

Answer: It is  a nominal rate per year

7 0
3 years ago
A particle moves along a circular path of radius 300 mm. If its angular velocity is θ = (2t) rad/s, where t is in seconds, deter
uysha [10]

Answer:

4.83m/s^{2}

Explanation:

For a particle moving in a circular path the resultant  acceleration at any point is the vector sum of radial and the tangential acceleration

Radial acceleration is given by a_{radial}=w^{2}r

Applying values we get  a_{radial}=(2t)^{2}X0.3m

Thus a_{radial}=1.2t^{2}

At time = 2seconds a_{radial}= 4.8m/s^{2}

The tangential acceleration is given by a_{tangential} =\frac{dV}{dt}=\frac{d(wr)}{dt}

a_{tangential}=\frac{d(2tr)}{dt}

a_{tangential}= 2r

a_{tangential}=0.6m/s^{2}

Thus the resultant acceleration is given by

a_{res} =\sqrt{a_{rad}^{2}+a_{tangential}^{2}}

a_{res} =\sqrt{4.8^{2}+0.6^{2}  } =4.83m/s^{2}

8 0
3 years ago
Other questions:
  • Practicing new things strains your brain fibers, weakening your ability to make connections.
    13·1 answer
  • How do you make coke for steel?
    14·1 answer
  • If there are 16 signal combinations (states) and a baud rate (number of signals/second) of 8000/second, how many bps could I sen
    9·1 answer
  • Block B starts from rest, block A moves with a constant acceleration, and slider block C moves to the right with a constant acce
    11·1 answer
  • What did the romans adopt from the Greek representation of the human art form
    15·1 answer
  • Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less
    12·1 answer
  • A spring-loaded piston-cylinder contains 1 kg of carbon dioxide. This system is heated from 104 kPa and 25 °C to 1,068 kPa and 3
    6·1 answer
  • Ma puteti ajuta cu un argument de 2 pagini despre inlocuirea garniturii de etansare de pe pistonul etrierului de franare la un a
    10·1 answer
  • Which of the following elements found in fertilizer helps plants produce fruit?
    15·2 answers
  • Concerning the storage battery, what category of the primary sources is voltage produced?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!