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
adell [148]
3 years ago
6

Charge a $5 penalty if an attempt is made to withdraw more money than available in the account.Here the account string is "S" or

"C". "S" is for savings account. "C" is for checking account. For the deposit or withdraw, it indicates which account is affected. For a transfer it indicates the account from which the money is taken; the money is automatically transferred to the other account.
Business
1 answer:
romanna [79]3 years ago
8 0

Answer:

C++ code is explained below

Explanation:

class Account {

 double balance;

 double add(double sum) {

   balance += sum;

   return sum;  

 }

 double withdraw(double sum) {

   if (sum > balance) {  

     balance -= 5;

     return -5; // this will come in handy in Prob. 6  

   } else {  

     balance -= sum;

     return balance; // Notice: always >= 0 (never < 0)

   }

 }

 double inquire() { return balance; }  

 Account() { balance = 0; }

 Account(double sum) { balance = sum; }

 double interest (double rate) {

   return rate * balance;  

 }

}

_______________________________

class Bank {

 Account checking;

 Account savings;  

 void deposit(double amount, String account) {

   if (account.equals("C")) checking.add(amount);  

   else // my default

     savings.add(amount);  

 }

 void withdraw(double amount, String account) {

   if (account.equals("C")) checking.withdraw(amount);  

   else // my default

     savings.withdraw(amount);  

 }

 void transfer (double amount, String account) {

   if (account.equals("C"))  

     if (checking.withdraw(amount) >= 0)  

       savings.add(amount);  

     else checking.add(5); // somewhat fault-tolerant

   else // default

     if (savings.withdraw(amount) >= 0)  

       checking.add(amount);  

     else savings.add(5);  // no penalty for transfers

 }

 void printBalances() {

   System.out.println(

     "Checking: " + checking.inquire() +

     "\nSavings: " + savings.inquire()

   );  

 }

}

You might be interested in
The market for gasoline has changed in a couple significant ways over the last few years: new technologies have decreased the co
Phantasy [73]
In economics, supply and demand refers to a relationship between the amount of a ware that producers wish to offer at different costs and the amount that consumers wish to purchase. 
Because of the way that automobiles are ending up more fuel proficient the general impact on the equilibrium cost of gasoline is that there will be a less need of gas required thus the cost will diminish or decrease. According to my thinking, it would be more beneficial to the economy due to the lesser degree a need however it would offer more gas because of the abatement in cost. Society utilizes different things that uses gas other than cars, for example, lawnmowers, tractors, bikes, and so on. So despite the fact that new advancements are diminishing the cost related with creating gas society still deliver items that utilizes fuel every day that will keep on having an impact on the equilibrium price overall.
4 0
3 years ago
Read 2 more answers
Hours of labor or number of workers are common ways of measuring a company's_______?
SIZIF [17.4K]
<span>Hours of labor or number of workers are common ways of measuring a company's_______?
</span><span>
Productivity


</span>
4 0
3 years ago
A(n) ________ is defined as a distinct unit within a brand or product line distinguishable by size, price, appearance, or some o
PSYCHO15rus [73]

Answer:

The correct answer is stockkeeping unit.

Explanation:

In the field of inventory management, an inventory maintenance unit or SKU refers to a specific item stored in a certain place. The SKU is considered the most disaggregated level when talking about inventory. It is assumed that the units stored in the same SKU are indistinguishable. The introduction of the SKU concept simplifies most inventory control operations. SKUs are sometimes used to designate intangible items, as guarantees; however, in this article we will focus on SKUs that designate tangible items.

8 0
3 years ago
As mentioned in the video, the US produces an annual "List of Goods Produced by Child Labor or Forced Labor." How effective do y
lina2011 [118]

Answer and Explanation:

By publishing the "List of Goods Produced by Child Labor or Forced Labor" the American government is able to raise awareness among the population that, although child labor is something inconceivable in American society, it still happens with great intensity in various places around the world. This allows the population to become aware of this situation and to stop buying products produced by companies that finance and allow child labor to happen. When they stop using these products, companies suffer a decrease in demand, which can cause significant changes in the production and in the lives of children who need to work.

While consumer pressure at companies that allow child labor is effective, pressure from political and commercial authorities is more effective in bringing about change and ensuring the protection of children, as these authorities can promote severe punishments for those who allow this to happen.

7 0
2 years ago
Corey is the city sales manager for RIBS, a national fast food franchise. Every working day, Corey drives his car as follows: Mi
Inessa [10]

Answer:

b.46 miles

Explanation:

Calculation to determine Corey's reimburseable mileage

Corey's reimburseable mileage= 15 miles + 18 miles + 13 miles

Corey's reimburseable mileage = 46 miles

Therefore As a result, Corey's reimburseable mileage is 46 miles

8 0
3 years ago
Other questions:
  • 1. Suppose Bank One offers a risk-free interest rate of 5.5% on both savings and loans, and Bank Enn offers a risk-free interest
    13·1 answer
  • Which of the following best describes the availability​ float? A. how long it takes the firm to process the check and deposit it
    7·1 answer
  • The records of Norton, Inc. show the following for July. Standard labor-hours allowed per unit of output 1.2 Standard variable o
    5·1 answer
  • Which of the following statements regarding the direct and indirect methods of reporting cash flow from operating activities is
    5·1 answer
  • If the superior's job with a particular employee during a performance appraisal is simply to sit and listen and then have open d
    15·1 answer
  • An investment will pay $200 at the end of each of the next 3 years, $300 at the end of Year 4, $500 at the end of Year 5, and $8
    13·1 answer
  • Del Norte Brick Co. is located near the intersection of Texas, New Mexico, and Mexico. Improved access to the company’s property
    5·1 answer
  • Which of the following crimes, by definition, involves the use of fear or Force
    12·1 answer
  • One employee is in charge of the following activities at a refreshment stand: Activity Activity Time per Customer Greet customer
    13·1 answer
  • To use the _____ method, a company must maintain records of inventory and purchases at cost and at current selling price.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!