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
3. (5%) you would like to physically separate different materials in a scrap recycling plant. describe at least one method that
Likurg_2 [28]

One of the methods that are used to separate polymers, aluminium alloys, and steels from one another is the Gravitation Separation method.

One straightforward technique is to run the mixture through a magnet, which will keep the steel particles on the magnet and separate them from the polymer.

What is the Gravitation Separation method?

When it is practicable to separate two components using gravity, i.e., when the combination's constituent parts have different specific weights, gravity separation is a technique used in industry. The components can be in suspension or in a dry granular mixture.

Polymers, Steel and Aluminium alloys can be readily split apart. The technique depends on how the two components are combined. The approach used is gravitational density. Due to the significant difference in relative specific mass values between steel and polymers (which range from 1.0 to 1.5), it is possible to separate them using flotation in a liquid that is safe and has the right density.

Therefore, the Gravitation Separation method is used to separate polymers, aluminium alloys and steels.

To learn more about the Polymer from the given link

brainly.com/question/2494725

#SPJ4

8 0
1 year ago
g A thin-walled pressure vessel 6-cm thick originally contained a small semicircular flaw (radius 0.50-cm) located at the inner
galben [10]

This question is not complete, the complete question is;

A thin-walled pressure vessel 6-cm thick originally contained a small semicircular flaw (radius 0.50-cm) located at the inner surface and oriented normal to the hoop stress direction. Repeated pressure cycling enabled the crack to grow larger. If the fracture toughness of the material is 88 Mpam^\frac{1}{2} , the yield strength equal to 1250 MPa, and the hoop stress equal to 300 MPa, would the vessel leak before it ruptured

Answer:

length of crack is 5.585 cm

we will observe that, the length of crack (5.585 cm) is less than the vessel thickness (6 cm) Hence, vessel will not leak before it ruptures

Explanation:

Given the data in the question;

vessel thickness = 6 cm

fracture toughness k = 88 Mpam^\frac{1}{2}

yield strength = 1250 MPa

hoop stress equal = 300 MPa

we know that, the relation between fracture toughness and crack length is expressed as;

k = (1.1)(2/π)(r√(πa))  

where k is the fracture toughness, r is hoop stress and a is length of crack

so we rearrange to find  length of crack

a = 1/π[( k / 1.1(r)(2/π)]²

a = 1/π[( kπ / 1.1(r)(2)]²

so we substitute  

a = 1/π [( 88π / 1.1(300)(2/π)]²    

a = 1/π[ 0.1754596 ]

a = 0.05585 m

a = 0.05585 × 100 cm

a = 5.585 cm  

so, length of crack is 5.585 cm

we will observe that, the length of crack (5.585 cm) is less than the vessel thickness (6 cm) Hence, vessel will not leak before it ruptures

8 0
3 years ago
A 150-lbm astronaut took his bathroom scale (a spring scale) and a beam scale (compares masses) to the moon where the local grav
kozerog [31]

Answer:

a)Wt =25.68 lbf

b)Wt = 150 lbf

F= 899.59 N

Explanation:

Given that

g = 5.48 ft/s^2.

m= 150 lbm

a)

Weight on the spring scale(Wt) = m g

We know that

1\ lbf=32.17 \ lmb.ft/s^2

Wt = 150 x 5.48/32 lbf

Wt =25.68 lbf

b)

On the beam scale

This is scale which does not affects by gravitational acceleration.So the wight on the beam scale will be 150 lbf.

Wt = 150 lbf

If the plane is moving upward with acceleration 6 g's then the for F

F = m a

We know that

1\ ft/s^2= 0.304\ m/s^2

5.48\ ft/s^2= 1.66\ m/s^2

a=6 g's

a=9.99\ m/s^2

So

F = 90 x 9.99 N

F= 899.59 N

3 0
3 years ago
Here you go!!!!!!!!!!!!!!!!!1
sweet [91]

Answer:

Im confused, what does this mean

Explanation:

i mean, thx lol

3 0
3 years ago
If 1 uF capacitor is fully charged with 120 V across it, how much energy is stored in it? (a) 7.2 kJ (b) 7.2 mJ (c) 0.12 mJ (d)
jeyben [28]

Answer:

(b) 7.2 mJ

Explanation:

ENERGY STORED IN CAPACITOR: the energy is stored in capacitor in electric field

which can be calculated by expressions

E=\frac{1}{2} c v{^2}

=\frac{1}{2} 10^{-6}120^{2}

=7200×10^{-6} J

= 7.2×10^{-3} J

=7.2 mJ

4 0
3 years ago
Other questions:
  • When a mesh in a circuit contains an independent or dependent current source, this leads to a special case of mesh-current analy
    14·1 answer
  • A minor road intersects a major 4-lane divided road with a design speed of 55mph and a median width of 8 feet. The intersection
    11·1 answer
  • Suppose an underground storage tank has been leaking for many years, contaminating a groundwater and causing a contaminant conce
    8·1 answer
  • 14. Tires are rotated to
    12·2 answers
  • You are a technical writer for Landson Toy Company. Landson has just designed a new, more durable swing set for 6- to 10-year-ol
    9·1 answer
  • Multiple Choice
    10·1 answer
  • Why do you think there are so many different kinds of can openers?
    10·1 answer
  • What is the name of the part of the expressway where cars can both enter and exit?
    15·1 answer
  • The only way to know if a design will work in real-world conditions is to build a model, or prototype, based on the plan. This i
    7·2 answers
  • Rivet gauge, or transverse pitch is the distance between the Group of answer choices heads of rivets in the same row. centers of
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!