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
10. Identify one material we Mine and what we make with that material
Katen [24]

Answer:

We Mine Limestone. Its used to make cement, toothpaste or paints, soil conditioner, and rip rap stone.

Explanation:

7 0
2 years ago
Describe the are of mechanical engineering
posledela

Answer:

Mechanical engineering is an engineering discipline that combines engineering physics and mathematics principles with materials science to design, analyze, manufacture, and maintain mechanical systems.

5 0
2 years ago
Read 2 more answers
g Consider a thin opaque, horizontal plate with an electrical heater on its backside. The front end is exposed to ambient air th
xxTIMURxx [149]

Answer:

The electrical power is 96.5 W/m^2

Explanation:

The energy balance is:

Ein-Eout=0

qe+\alpha sGs+\alpha skyGsky-EEb(Ts)-qc=0

if:

Gsky=oTsky^4

Eb=oTs^4

qc=h(Ts-Tα)

\alpha s=\frac{\int\limits^\alpha _0 {\alpha l Gl} \, dl }{\int\limits^\alpha _0 {Gl} \, dl }

\alpha s=\frac{\int\limits^\alpha _0 {\alpha lEl(l,5800 } \, dl }{\int\limits^\alpha _0 {El(l,5800)} \, dl }

if Gl≈El(l,5800)

\alpha s=(1-0.2)F(0-2)+(1-0.7)(1-F(0-2))

lt= 2*5800=11600 um-K, at this value, F=0.941

\alpha s=(0.8*0.941)+0.3(1-0.941)=0.77

The hemispherical emissivity is equal to:

E=(1-0.2)F(0-2)+(1-0.7)(1-F(0-2))

lt=2*333=666 K, at this value, F=0

E=0+(1-0.7)(1)=0.3

The hemispherical absorptivity is equal to:

qe=EoTs^{4}+h(Ts-T\alpha  )-\alpha sGs-\alpha oTsky^{4}=(0.3*5.67x10^{-8}*333^{4})+10(60-20)-(0.77-600)-(0.3*5.67x10^{-8}*233^{4})=96.5 W/m^{2}

3 0
3 years ago
Does somebody know how to do this?
maksim [4K]
No I don’t sorry, I hope you do well
4 0
2 years ago
Which crystal system(s) listed below has (have) the following relationship for the unit cell edge lengths?
lianna [129]

Answer:

Both B and G ( Hexagonal and Tetragonal )

Explanation:

The crystals system listed below has the following relationship for the unit cell edge lengths; a = b ≠ c ( hexagonal and Tetragonal )

hexagonal ; represents  a crystal system  which has three equal axes that have an angle of 60⁰ between them while Tetragonal denotes crystals that have  three axes which have only two of its axes equal in length.

5 0
2 years ago
Other questions:
  • Pine Valley Furniture wants to use Internet systems to provide value to its customers and staff. There are many software technol
    5·1 answer
  • Complex poles cmd zeros. Sketch the asymptotes of the Bode plot magnitude and phase for each of the listed open-loop mmsfer fuoc
    10·1 answer
  • Air enters a compressor operating at steady state with pressure of 90 kPa, at a temperature of 350 K, and a volumetric flow rate
    13·1 answer
  • Which tool is used to pull the tapered shaft on a tie-rod end from its mating steering component?
    9·1 answer
  • The following liquids are stored in a storage vessel at 1 atm and 25°C. The vessels are vented with air. Determine whether the e
    5·1 answer
  • The basic concept of feedback control is that an error must exist before some corrective action can be made?
    12·1 answer
  • Mobility refers to the ability to?
    12·1 answer
  • How do i open a door<br> please i've been trapped in this room for ages
    9·1 answer
  • As you push a toggle bolt into a wall, the
    13·1 answer
  • What current must flow if 0.24 coulombs is to be transferred in 15ms?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!