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
What test should be performed on abrasive wheels
Svet_ta [14]

Answer:

before wheel is put on it should be looked at for damage and a sound or ring test should be done to check for cracks, to test the wheel it should be tapped with a non metallic instrument (I looked it up)

3 0
3 years ago
Read 2 more answers
Current density is given in cylindrical coordinates as J = −106z1.5az A/m2 in the region 0 ≤ rho ≤ 20 µm; for rho ≥ 20 µm, J = 0
Naily [24]

Question:

Current density is given in cylindrical coordinates as J = −10^6z^1.5az A/m² in the region 0 ≤ ρ ≤ 20 µm; for ρ ≥ 20 µm, J = 0.

(a) Find the total current crossing the surface z = 0.1 m in the az direction.

(b) If the charge velocity is 2 × 10^6 m/s at z = 0.1 m, find ρν there.

(c) If the volume charge density at z = 0.15 m is −2000 C/m3, find the charge velocity there.

Answer:

a. -39.8μA

b. -15.81mC/m³

c. 29.05m/s

Explanation:

Given

Density = J = −10^6z^1.5az A/m²

Region: 0 ≤ ρ ≤ 20 µm

ρ ≥ 20 µm

J = 0.

a. Total current is calculated by.

J * ½((ρ1)² - (ρ0)²) * 2 π * φdza.

Where J = Density = -10^6 * z^1.5

ρ1 = Upper bound of ρ = 20

ρ0 = Lower bound of ρ = 0

π = 22/7

φdza = 10^-6

z = 0.1

Total current

= -10^6 * z^1.5 * ½(20² - 0²) * 2 * 22/7 * 10^-6

= 10^6 * 0.1^1.5 * ½(20² - 0²) * 2 * 22/7 * 10^-6

= −39.7543477278310

= -39.8μA

b. Calculating velocity charge density at (ρv)

Density (J) = ρv * V

Where J = Density = -10^6 * z^1.5

V = 2 * 10^6

z = 0.1

Substitute the above values

-10^6 * 0.1 ^1.5 = ρv * 2 * 10^6

ρv = (-10^6 * 0.1^1.5)/(2 * 10^6)

ρv = -0.1^1.5/(2)

ρv = -0.015811388300841

ρv = -0.01581 --------- Approximated

ρv = -15.81mC/m³

c. Calculating Velocity

Velocity = J/V

Where Velocity Charge Density = -2000 C/m3

Where J = -10^6 * z^1.5

z = 0.15

J = -10^6 * 0.15^1.5

J = -58094.75019311125

Velocity = -58094.75019311125/-2000

Velocity = 29.047375096555625m/s

Velocity = 29.05m/s

8 0
3 years ago
Roads in rural areas are _______.
Roman55 [17]

Answer:

Explanation:

Mountain roads often zigzag across a mountain with a series of sharp turns called. switchbacks.

6 0
3 years ago
Read 2 more answers
g A steel water pipe has an inner diameter of 12 in. and a wall thickness of 0.25 in. Determine the longitudinal and hoop stress
zvonat [6]

Answer:

a) \mathbf{\sigma _ 1 = 4800 psi}

     \mathbf{ \sigma _2 = 0}

b)\mathbf{\sigma _ 1 = 6000 psi}

  \mathbf{ \sigma _2 = 3000 psi}

Explanation:

Given that:

diameter d = 12 in

thickness t = 0.25 in

the radius = d/2 = 12 / 2 = 6 in

r/t = 6/0.25 = 24

24 > 10

Using the  thin wall cylinder formula;

The valve A is opened and the flowing water has a pressure P of 200 psi.

So;

\sigma_{hoop} = \sigma _ 1 = \frac{Pd}{2t}

\sigma_{long} = \sigma _2 = 0

\sigma _ 1 = \frac{Pd}{2t} \\ \\ \sigma _ 1 = \frac{200(12)}{2(0.25)}

\mathbf{\sigma _ 1 = 4800 psi}

b)The valve A is closed and the water pressure P is 250 psi.

where P = 250 psi

\sigma_{hoop} = \sigma _ 1 = \frac{Pd}{2t}

\sigma_{long} = \sigma _2 = \frac{Pd}{4t}

\sigma _ 1 = \frac{Pd}{2t} \\ \\ \sigma _ 1 = \frac{250*(12)}{2(0.25)}

\mathbf{\sigma _ 1 = 6000 psi}

\sigma _2 = \frac{Pd}{4t} \\ \\  \sigma _2 = \frac{250(12)}{4(0.25)}

\mathbf{ \sigma _2 = 3000 psi}

The free flow body diagram showing the state of stress on a volume element located on the wall at point B is attached in the diagram below

8 0
3 years ago
From what side of the vessel should you never anchor
Pavel [41]

Answer:

Never anchor from the stern as this can cause the boat to swamp.

Explanation:

Brainliest pls

6 0
2 years ago
Other questions:
  • Remy noticed that after oiling his skateboard wheels, it was easier to reach the speeds he needed to perform tricks. How did the
    6·1 answer
  • Consider a steam turbine, with inflow at 500oC and 7.9 MPa. The machine has a total-to-static efficiency ofηts=0.91, and the pre
    14·1 answer
  • Establishes general guidelines concerning licensing and vehicle
    10·2 answers
  • The yield of a chemical process is being studied.The two most important variables are thought to be the pressure and the tempera
    9·1 answer
  • What would be the most likely scale factor to use for an n-gauge model train setup? (An n-gauge layout uses locomotives that are
    8·1 answer
  • 12. A structural component is fabricated from an alloy that has a plane strain fracture toughness of It has been determined that
    11·1 answer
  • Which type of Bridge is considered the strongest in both compression and tension?
    11·2 answers
  • Do you know who Candice is
    8·2 answers
  • 2) What kinds of food can you eat in space?
    14·2 answers
  • A(n) _____ is an apparatus that changes alternating current (AC) to direct current (DC)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!