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 a very long, cylindrical fin. The temperature of the fin at the tip and base are 25 °C and 50 °C, respectively. The dia
nekit [7.7K]

Answer:

98°C

Explanation:

Total surface area of cylindrical fin = πr² + 2πrl , r = 0.015m; l= 0.1m; π =22/7

22/7*(0.015)² + 22/7*0.015*0.1 = 7.07 X 10∧-4 + 47.1 X 10∧-4 = (54.17 X 10∧-4)m²

Temperature change, t = (50 - 25)°C = 25°C = 298K

Hence, Temperature =  150 X (54.17 X 10∧-4) X 298/123 = 242.14/124 = 2.00K =

∴ Temperature change = 2.00K

But temperature, T= (373 - 2)K = 371 K

In °C = (371 - 273)K = 98°C         

7 0
3 years ago
All of the following safety tips are true EXCEPT Select one: a. It is not acceptable to handle broken glass with your bare hands
netineya [11]

Answer:

Explanation:

B. you would grab the plug closest to the outlet

8 0
3 years ago
an inclined manometer is connected to a pitor tube to measure the velocity at the center of a circular duct. If the inclined man
jekas [21]
57.5 m/s
I did 2.3/0.04
I’m not sure if it’s correct though
8 0
3 years ago
What is the core domain for Accenture’s Multi-party Systems practice?
12345 [234]

Answer:

a

Explanation:

digital identity is the answer

6 0
3 years ago
Two fluids, A and B exchange heat in a counter – current heat exchanger. Fluid A enters at 4200C and has a mass flow rate of 1 k
Volgvan

Answer:

Your question has some missing information below is the missing information

Given that ( specific heat of fluid A = 1 kJ/kg K and specific heat of fluid B = 4 kJ/kg k )

answer : 300 kW , 95°c

Explanation:

Given data:

Fluid A ;

Temperature of Fluid ( Th1 )  = 420° C

mass flow rate (mh)  = 1 kg/s

Fluid B :

Temperature ( Tc1) = 20° C

mass flow rate ( mc ) = 1 kg/s

effectiveness of heat exchanger = 75% = 0.75

<u>Determine the heat transfer rate and  exit temperature of fluid</u> <u>B</u>

Cph = 1000 J/kgk

Cpc = 4000 J/Kgk

Given that the exit temperatures of both fluids are not given we will apply the NTU will be used to determine the heat transfer rate and exit temperature of fluid B

exit temp of fluid  B = 95°C

heat transfer = 300 kW

attached below is a the detailed solution

5 0
3 years ago
Other questions:
  • Your driver license will be _____ if you race another driver on a public road, commit a felony using a motor vehicle, or are fou
    6·2 answers
  • Describe three advantages and three disadvantages of JIT?
    12·1 answer
  • The car travels around the portion of a circular track having a radius of r = 500 ft such that when it is at point A it has a ve
    14·1 answer
  • The maximum stress that a bar will withstand before failing is called • Rapture Strength • Yield Strength • Tensile Strength • B
    5·1 answer
  • A tension test is carried out on an Al alloy specimen which has an original diameter of 0.505 in and an original gauge length of
    15·1 answer
  • (4 points) What field of work generally requires (a) an engineer to have a Professional Engineer
    11·1 answer
  • 30POINTS
    15·2 answers
  • There are three homes being built, each with an identical deck on the back. Each deck is comprised of two separate areas. One ar
    7·1 answer
  • How many times greater is the value of the 2 of the 270413 than the valuce of the 2 in 419427?
    8·1 answer
  • Describe two other safe driver skills a driver should use when driving in this road condition
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!