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
2. One of the many methods used for drying air is to cool the air below the dew point so that condensation or freezing of the mo
REY [17]

Answer:

0.5°c

Explanation:

Humidity ratio by mass can be expressed as

the ratio between the actual mass of water vapor present in moist air - to the mass of the dry air

Humidity ratio is normally expressed in kilograms (or pounds) of water vapor per kilogram (or pound) of dry air.

Humidity ratio expressed by mass:

x = mw / ma                                  (1)

where

x = humidity ratio (kgwater/kgdry_air, lbwater/lbdry_air)

mw = mass of water vapor (kg, lb)

ma = mass of dry air (kg, lb)

It can be as:

x = 0.005 (100) / [(100 - 100)]

x = 0.005 x 100 / (100 - 100)

x = 0.005 x 100 / 0

x = 0.5°c

So the temperature to which atmospheric air must be cooled in order to have humidity ratio of 0.005 lb/lb is 0.5°c

6 0
3 years ago
Select the correct answer.
Ulleksa [173]
The answer is A. Immediately inform her colleague
4 0
3 years ago
What was a campaign belief in the 1980 presidential election? Carter called for a stronger national defense. Carter promised to
andreyandreev [35.5K]

Answer:

C

Explanation:

On edge 2021

6 0
3 years ago
Read 2 more answers
When the rod is circular, radial lines remain straight and sections perpendicular to the axis do not warp. In this case, the str
Murljashka [212]

The question is incomplete. The complete question is :

The solid rod shown is fixed to a wall, and a torque T = 85N?m is applied to the end of the rod. The diameter of the rod is 46mm .

When the rod is circular, radial lines remain straight and sections perpendicular to the axis do not warp. In this case, the strains vary linearly along radial lines. Within the proportional limit, the stress also varies linearly along radial lines. If point A is located 12 mm from the center of the rod, what is the magnitude of the shear stress at that point?

Solution :

Given data :

Diameter of the rod : 46 mm

Torque, T = 85 Nm

The polar moment of inertia of the shaft is given by :

$J=\frac{\pi}{32}d^4$

$J=\frac{\pi}{32}\times (46)^4$

J = 207.6 mm^4

So the shear stress at point  A is :

$\tau_A =\frac{Tc_A}{J}$

$\tau_A =\frac{85 \times 10^3\times 12 }{207.6}$

$\tau_A = 4913.29 \ MPa$

Therefore, the magnitude of the shear stress at point A is 4913.29 MPa.

3 0
2 years ago
What must engineers keep in mind so that their solutions will be appropriate?
vekshin1

Answer:

Context

Explanation:

It is of great value for an engineer to keep the context of his/her experiment in mind.

7 0
2 years ago
Other questions:
  • Water is the working fluid in an ideal Rankine cycle. Superheatedvapor enters the turbine at 10MPa, 480°C, and the condenser pre
    10·1 answer
  • Alberto's mom is taking a splinter out of his hand with a pair of tweezers. The tweezers are 3 inches long. She is applying .25
    12·2 answers
  • Water, in a 150 in^3 rigid tank, initially has a temperature of 70°F and an enthalpy of 723.5 Btu/lbm. Heat is added until the w
    13·1 answer
  • Please answer question #2
    6·1 answer
  • Determine the average and rms values for the function, y(t)=25+10sino it over the time periods (a) 0 to 0.1 sec and (b) 0 to 1/3
    9·1 answer
  • A 400-MVA, 240-kV/24-kV, three-phase Y-A transformer has an equivalent series impedance of 1.2 + j6 N per phase referred to the
    13·1 answer
  • A cylindrical tank with a radius of 2-m is filled with oil and water. The water has a density of rho = 1000 kg/m3 while the oil
    6·1 answer
  • Carbon dioxide (CO2) expands isothermally at steady state with no irreversibilities through a turbine from 10 bar, 500 K to 2 ba
    15·1 answer
  • A minor road intersects a major 4-lane divided road with a design speed of 50 mph and a median width of 12 ft. The intersection
    13·1 answer
  • 1) Plastics that soften when heated,harden when cooled, and then can be heated and softened many times
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!