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 is the volume of the rectangular prism shown.
Likurg_2 [28]
It would be 72cm bc u need to add up all the line in the back to
7 0
3 years ago
It is appropriate to use the following yield or failure criterion for ductile materials (a) Maximum shear stress or Tresca crite
Nataly [62]

Answer:

(b)Distortion energy theory.

Explanation:

The best suitable theory for ductile material:

       (1)Maximum shear stress theory (Guest and Tresca theory)

It theory state that applied maximum shear stress should be less or equal to its maximum shear strength.

      (2)Maximum distortion energy theory(Von Mises henkey's        theory)

It states that maximum shear train energy per unit volume at any point  is equal to strain energy per unit volume under the state of uni axial stress condition.

But from these two Best theories ,suitable theory is distortion energy theory ,because it gives best suitable result for ductile material.

6 0
3 years ago
Can you use isentropic efficiency for a non-adiabatic compressor?
vodomira [7]
Mark brainliest please!

Isothermal work will be less than the adiabatic work for any given compression ratio and set of suction conditions. The ratio of isothermal work to the actual work is the isothermal efficiency. Isothermal paths are not typically used in most industrial compressor calculations.

Compressors

Compressors are used to move gases and vapors in situations where large pressure differences are necessary.

Types of Compressor

Compressors are classified by the way they work: dynamic (centrifugal and axial) or reciprocating. Dynamic compressors use a set of rotating blades to add velocity and pressure to fluid. They operate at high speeds and are driven by steam or gas turbines or electric motors. They tend to be smaller and lighter for a given service than reciprocating machines, and hence have lower costs.

Reciprocating compressors use pistons to push gas to a higher pressure. They are common in natural gas gathering and transmission systems, but are less common in process applications. Reciprocating compressors may be used when very large pressure differences must be achieved; however, since they produce a pulsating flow, they may need to have a receiver vessel to dampen the pulses.

The compression ratio, pout over pin, is a key parameter in understanding compressors and blowers. When the compression ratio is below 4 or so, a blower is usually adequate. Higher ratios require a compressor, or multiple compressor stages, be used.

When the pressure of a gas is increased in an adiabatic system, the temperature of the fluid must rise. Since the temperature change is accompanied by a change in the specific volume, the work necessary to compress a unit of fluid also changes. Consequently, many compressors must be accompanied by cooling to reduce the consequences of the adiabatic temperature rise. The coolant may flow through a jacket which surrounds the housing with liquid coolant. When multiple stage compressors are used, intercooler heat exchangers are often used between the stages.

Dynamic Compressors

Gas enters a centrifugal or axial compressor through a suction nozzle and is directed into the first-stage impeller by a set of guide vanes. The blades push the gas forward and into a diffuser section where the gas velocity is slowed and the kinetic energy transferred from the blades is converted to pressure. In a multistage compressor, the gas encounters another set of guide vanes and the compression step is repeated. If necessary, the gas may pass through a cooling loop between stages.

Compressor Work

To evaluate the work requirements of a compressor, start with the mechanical energy balance. In most compressors, kinetic and potential energy changes are small, so velocity and static head terms may be neglected. As with pumps, friction can be lumped into the work term by using an efficiency. Unlike pumps, the fluid cannot be treated as incompressible, so a differential equation is required:

Compressor Work
Evaluation of the integral requires that the compression path be known - - is it adiabatic, isothermal, or polytropic?
uncooled units -- adiabatic, isentropic compression
complete cooling during compression -- isothermal compression
large compressors or incomplete cooling -- polytropic compression
Before calculating a compressor cycle, gas properties (heat capacity ratio, compressibility, molecular weight, etc.) must be determined for the fluid to be compressed. For mixtures, use an appropriate weighted mean value for the specific heats and molecular weight.

Adiabatic, Isentropic Compression

If there is no heat transfer to or from the gas being compressed, the porocess is adiabatic and isentropic. From thermodynamics and the study of compressible flow, you are supposed to recall that an ideal gas compression path depends on:

Adiabatic Path
This can be rearranged to solve for density in terms of one known pressure and substituted into the work equation, which then can be integrated.
Adiabatic Work
The ratio of the isentropic work to the actual work is called the adiabatic efficiency (or isentropic efficiency). The outlet temperature may be calculated from
Adiabatic Temperature Change
Power is found by multiplying the work by the mass flow rate and adjusting for the units and efficiency.
Isothermal Compression

If heat is removed from the gas during compression, an isothermal compression cycle may be achieved. In this case, the work may be calculated from:

http://facstaff.cbu.edu/rprice/lectures/compress.html
4 0
3 years ago
Which kind of fracture (ductile or brittle) is associated with each of the two crack propagation mechanisms?
Nina [5.8K]

dutile is the correct answer

6 0
3 years ago
Training is a way for employers to provide ____ to enable employees to protect themselves and others from injuries.
Andreyy89

Answer:

Training is a way for employers to provide tools to enable employees to protect themselves and others from injuries.

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • The popularity of orange juice, especially as a breakfast drink, makes it an important factor in the economy of orange-growing r
    14·1 answer
  • What are the challenges posed by strategic information systems, and how should they be addressed?
    10·1 answer
  • The wet density of a sand was found to be 1.9 Mg/m3 and the field water content was 10%. In the laboratory, the density of solid
    9·1 answer
  • Write a modular program that finds the equation, area, and circumference of a circle, given the coordinates of the center of the
    11·1 answer
  • A six-lane multilane highway (three lanes in each direction) has a peak-hour factor of 0.90, 11-ft lanes with a 4-ft right-side
    11·1 answer
  • I'm really bad at measurements so I don't understand this.
    12·1 answer
  • Under the normal sign convention, the distributed load on a beam is equal to the:_______A. The rate of change of the bending mom
    13·1 answer
  • A positive slope on a position-time graph suggests
    15·1 answer
  • Merchandise without an expiration date like electronics, tools and home goods typically have a longer
    15·1 answer
  • Additional scals apply to the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!