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
A saturated 1.5 ft3 clay sample has a natural water content of 25%, shrinkage limit (SL) of 12% and a specific gravity (GS) of 2
Svetllana [295]

79 f t^{3} is the volume of the sample when the water content is 10%.

<u>Explanation:</u>

Given Data:

V_{1}=100\ \mathrm{ft}^{3}

First has a natural water content of 25% = \frac{25}{100} = 0.25

Shrinkage limit, w_{1}=12 \%=\frac{12}{100}=0.12

G_{s}=2.70

We need to determine the volume of the sample when the water content is 10% (0.10). As we know,

V \propto[1+e]

\frac{V_{2}}{V_{1}}=\frac{1+e_{2}}{1+e_{1}}  ------> eq 1

e_{1}=\frac{w_{1} \times G_{s}}{S_{r}}

The above equation is at S_{r}=1,

e_{1}=w_{1} \times G_{s}

Applying the given values, we get

e_{1}=0.25 \times 2.70=0.675

Shrinkage limit is lowest water content

e_{2}=w_{2} \times G_{s}

Applying the given values, we get

e_{2}=0.12 \times 2.70=0.324

Applying the found values in eq 1, we get

\frac{V_{2}}{100}=\frac{1+0.324}{1+0.675}=\frac{1.324}{1.675}=0.7904

V_{2}=0.7904 \times 100=79\ \mathrm{ft}^{3}

7 0
3 years ago
Determine the dimensions for W if W = P L^3 / (M V^2) where P is a pressure, L is a length, M is a mass, and V is a velocity.
Eva8 [605]

Correct answer is option E. No dimensions

As we know formula Pressure (P) is \frac{F}{A}

also,

  • Dimensional formula of <em>Pressure is </em>M^{1}L^{-1}T^{-2}
  • Dimensional formula of <em>length is L </em>
  • Dimensional formula of <em>mass is M</em>
  • Dimensional formula  of <em>velocity is </em>L^{1} T^{-1}

So, as given W=\frac{P*L^{3} }{M*V^{2} }

Dimensional formula of W =\frac{M^{1}L^{-1}T^{-2}  L^{3}  }{M^{1} L^{2}T^{-2}   }

since all terms get cancelled

Work is dimensionless i.e no dimensions

Learn more about dimensions here brainly.com/question/20351712

#SPJ10

6 0
2 years ago
Two identical billiard balls can move freely on a horizontal table. Ball a has a velocity V0 and hits balls B, which is at rest,
Lyrx [107]

Answer:

Velocity of ball B after impact is 0.6364v_0 and ball A is 0.711v_0

Explanation:

v_0 = Initial velocity of ball A

v_A=v_0\cos45^{\circ}

v_B = Initial velocity of ball B = 0

(v_A)_n' = Final velocity of ball A

v_B' = Final velocity of ball B

e = Coefficient of restitution = 0.8

From the conservation of momentum along the normal we have

mv_A+mv_B=m(v_A)_n'+mv_B'\\\Rightarrow v_0\cos45^{\circ}+0=(v_A)_n'+v_B'\\\Rightarrow (v_A)_n'+v_B'=\dfrac{1}{\sqrt{2}}v_0

Coefficient of restitution is given by

e=\dfrac{v_B'-(v_A)_n'}{v_A-v_B}\\\Rightarrow 0.8=\dfrac{v_B'-(v_A)_n'}{v_0\cos45^{\circ}}\\\Rightarrow v_B'-(v_A)_n'=\dfrac{0.8}{\sqrt{2}}v_0

(v_A)_n'+v_B'=\dfrac{1}{\sqrt{2}}v_0

v_B'-(v_A)_n'=\dfrac{0.8}{\sqrt{2}}v_0

Adding the above two equations we get

2v_B'=\dfrac{1.8}{\sqrt{2}}v_0\\\Rightarrow v_B'=\dfrac{0.9}{\sqrt{2}}v_0

\boldsymbol{\therefore v_B'=0.6364v_0}

(v_A)_n'=\dfrac{1}{\sqrt{2}}v_0-0.6364v_0\\\Rightarrow (v_A)_n'=0.07071v_0

From the conservation of momentum along the plane of contact we have

(v_A)_t'=(v_A)_t=v_0\sin45^{\circ}\\\Rightarrow (v_A)_t'=\dfrac{v_0}{\sqrt{2}}

v_A'=\sqrt{(v_A)_t'^2+(v_A)_n'^2}\\\Rightarrow v_A'=\sqrt{(\dfrac{v_0}{\sqrt{2}})^2+(0.07071v_0)^2}\\\Rightarrow \boldsymbol{v_A'=0.711v_0}

Velocity of ball B after impact is 0.6364v_0 and ball A is 0.711v_0.

5 0
3 years ago
Which of the following uses pressure and flow to transmit power from one location to another?
lord [1]

Answer:

fluid power

Explanation:

fluids commonly used in fluid power are Oil, Water, Air, CO², and Nitrogen gas, fluid power is commonly confused with hydraulic power, which only uses liquids, fluid power uses either liquids or gases

5 0
2 years ago
Alcohol consumption tends to cause more ___________ behavior.
lions [1.4K]

Answer:

Aggressive behavior

Explanation:

Alcohol consumption tends to cause more Aggressive behavior.

The consumption of alcohol plays a more role in our culture but drinking of too much alcohol can cause drowsiness, vomiting, Upset stomach, slurred speech, heart damage, infertile, numbness lung infections, and many more. Also too much alcohol can cause violence, anger and so on in the society.    

8 0
3 years ago
Other questions:
  • The uniform dresser has a weight of 90 lb and rests on a tile floor for which the coefficient of static friction is 0.25. If the
    6·1 answer
  • Find the pressure exerted by the water bed on the floor when the bed rests in its normal position. Assume the entire lower surfa
    12·1 answer
  • For what two reasons do countries specialize? Countries specialize so that opportunity costs can be increased. Countries special
    13·1 answer
  • The densities of several materials are given in SI units. Convert these to densities in U.S. customary units (slug/ft3), and als
    12·1 answer
  • Technician A says that the paper test could detect a burned valve. Technician B says that a grayish white stain on the engine co
    14·1 answer
  • Ammonia in a piston–cylinder assembly undergoes two processes in series. At the initial state, p1 = 120 lbf/in.2 and the quality
    15·1 answer
  • Problem 89:A given load is driven by a 480 V six-pole 150 hp three-phase synchronous motor with the following load and motor dat
    11·1 answer
  • A battery with an f.e.m. of 12 V and negligible internal resistance is connected to a resistor of 545 How much energy is dissipa
    9·1 answer
  • Which Two moon phases are directly opposite each other?
    9·2 answers
  • It is illegal to improperly dispose of antifreeze.<br> True<br> False
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!