Write a C++ function for the following:
Suppose that Account class has a method called withdraw, which will be inherited by Checking and Savings class. The withdraw method will perform according to account type. So, the late bind is needed. Declare the withdraw method in Account class. The method should take a double input as withdraw amount and output true if the withdraw successfully and false if the withdraw unsuccessfully.

Answers

Answer 1

Solution :

class Account

[tex]$ \{ $[/tex]

public:

[tex]$\text{Account}()$[/tex];

double [tex]$\text{getBalance}$[/tex]();

void [tex]$\text{setBalance}$[/tex]();

[tex]$\text{bool withdraw}$[/tex](double bal);

[tex]$\text{private}:$[/tex]

double [tex]$\text{balance}$[/tex];

}:

[tex]$\text{Account}()$[/tex] {}

double [tex]$\text{getBalance}$[/tex]()

[tex]$ \{ $[/tex]

[tex]$\text{return balance}$[/tex];

}

void [tex]$\text{setBalance}$[/tex](double [tex]$\text{balance}$[/tex])

[tex]$ \{ $[/tex]

this.[tex]$\text{balance}$[/tex] = [tex]$\text{balance}$[/tex];

}

[tex]$\text{boolean}$[/tex] withdraw([tex]$\text{double bal}$[/tex])

[tex]$ \{ $[/tex]

if([tex]$\text{balance}$[/tex] >= bal)

[tex]$ \{ $[/tex]

[tex]$\text{balance}$[/tex] = [tex]$\text{balance}$[/tex] - bal;

[tex]$\text{return}$[/tex] true;

}

[tex]$\text{return}$[/tex] false;

}

}


Related Questions

If a system contains 1,000 disk drives, each of which has a 750,000- hour MTBF, which of the following best describes how often a drive failure will occur in that disk farm:

a. once per thousand years
b. once per century, once per decade
c. once per year, once per month
d. once per week
e. once per day
f. once per hour
g. once per minute
h. once per second

Answers

Answer:

once per month

Explanation:

The correct answer is - once per month

Reason -

Probability of 1 failure of 1000 hard disk = 750,000/1000 = 750 hrs

So,

750/24 = 31.25 days

⇒ approximately one in a month.

a buffer storage that improve computer performance by reducing access time is​

Answers

Cache memory

Hope it helps

Note that common skills are listed toward the top, and less common skills are listed toward the bottom. According to O*NET, what are common skills needed by Secondary School Special Education Teachers? Check all that apply.

instructing
installation
learning strategies
repairing
active listening
technology design

Answers

Answer:

A. Instucting   C. Learning Strategies   E. Active Listening

Explanation:

Got it right on assignment

The city of Green Acres is holding an election for mayor. City officials have decided to automate the process of tabulating election returns and have hired your company to develop a piece of software to monitor this process. The city is divided into five precincts. On election day, voters go to their assigned precinct and cast their ballots. All votes cast in a precinct are stored in a data file that is transmitted to a central location for tabulation.

Required:
Develop a program to count the incoming votes at election central.

Answers

Answer:

Explanation:

The following program asks the user to enter the precinct number and then loops to add votes until no more votes need to be added. Then it breaks the loop and creates a file called results to save all of the results for that precinct.

precinct = input("Enter Precinct Number: ")

option1 = 0

option2 = 0

while True:

   choice = input("Enter your vote 1 or 2: ")

   if int(choice) == 1:

       option1 += 1

   else:

       option2 += 1

   endVote = input("Vote again y/n")

   if endVote.lower() != 'y':

       break

f = open("results.txt", "w")

f.write("Precinct " + precinct + ": \nOption 1: " + str(option1) + "\nOption 2: " + str(option2))

PLS HELP SO I CAN PASS WILL GIVE BRAINLINESS AND 30 POINTS
Charlie Chaplin is know for developing

a
The Dramedy
b
Early Special Effects
c
Slap-Stick
d
The Prat-Fall
Question 2 (1 point)
Chaplin felt it was important for the audience to

a
turn off their cellphones during the movie.
b
believe the stunts were real by doing them himself.
c
escape from their problems by avoiding difficult topics.
d
have an emotional connection with the characters.
Question 3 (3 points)
Match the silent film with its modern influence

Column A
1.
Metropolis:
Metropolis
2.
The Kid:
The Kid
3.
Nosferatu:
Nosferatu
Column B
a.Freddy Kruger
b.The Simpsons
c.Sharknado
d.Star Wars
Question 4 (1 point)
How did Nosferatu change the Vampire cannon (story)?

a
Vampires are friendly
b
Vampires can be killed by sunlight
c
Vampires can become invisible
d
Vampires can be repelled by garlic
Question 5 (1 point)
Metropolis was the first film to

a
have religious undertones.
b
use special effects.
c
have humanoid robots.
d
use Gothic Imagery.


movies being the kid , nosferatu , and metropolis

Answers

Answer:

a

have religious undertones.

b

use special effects.

c

have humanoid robots.

d

use Gothic Imagery.

Explanation:

You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you realize that some boxcars are overloaded and weigh too heavily on the rails while others are dangerously light. So you decide to stop the train and spread the weight more evenly so that all the boxcars have exactly the same weight (without changing the total weight). For that you write a program which helps you in the distribution of the weight.
Your program should first read the number of cars to be weighed (integer) followed by the weights of the cars (doubles). Then your program should calculate and display how much weight to add or subtract from each car such that every car has the same weight. The total weight of all of the cars should not change. These additions and subtractions of weights should be displayed with one decimal place. You may assume that there are no more than 50 boxcars.
Example 1
In this example, there are 5 boxcars with different weights summing to 110.0. The ouput shows that we are modifying all the boxcars so that they each carry a weight of 22.0 (which makes a total of 110.0 for the entire train). So we remove 18.0 for the first boxcar, we add 10.0 for the second, we add 2.0 for the third, etc.
Input
5
40.0
12.0
20.0
5. 33.
0
Output
- 18.0
10.0
2.0
17.0
-11.0

Answers

Answer:

The program in C++ is as follows:

#include <iostream>

#include <iomanip>

using namespace std;

int main(){

   int cars;

   cin>>cars;

   double weights[cars];

   double total = 0;

   for(int i = 0; i<cars;i++){

       cin>>weights[i];

       total+=weights[i];    }

   double avg = total/cars;

   for(int i = 0; i<cars;i++){

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

   return 0;

}

Explanation:

This declares the number of cars as integers

   int cars;

This gets input for the number of cars

   cin>>cars;

This declares the weight of the cars as an array of double datatype

   double weights[cars];

This initializes the total weights to 0

   double total = 0;

This iterates through the number of cars

   for(int i = 0; i<cars;i++){

This gets input for each weight

       cin>>weights[i];

This adds up the total weight

       total+=weights[i];    }

This calculates the average weights

   double avg = total/cars;

This iterates through the number of cars

   for(int i = 0; i<cars;i++){

This prints how much weight to be added or subtracted

       cout<<fixed<<setprecision(1)<<avg-weights[i]<<endl;    }

What methods do phishing and spoofing scammers use?

Answers

Answer:

please give me brainlist and follow

Explanation:

There are various phishing techniques used by attackers:

Installing a Trojan via a malicious email attachment or ad which will allow the intruder to exploit loopholes and obtain sensitive information. Spoofing the sender address in an email to appear as a reputable source and request sensitive information

your computer has been running slowly and you suspect it because its is low on memory. you review the hardware configuration and find that computer has only 4gb of ram. how can you determine how much memory your computer should have to run properly?​

Answers

By downloading software that is capable of checking live Ram usage/need. GIVE BRAINLIST

4 reasons why users attach speakers
to their computers​

Answers

Answer: we connected speakers with computers for listening voices or sound because the computer has not their own speaker. the purpose of speakers is to produce audio output that can be heard by the listener. Speakers are transducers that convert electromagnetic waves into sound waves. The speakers receive audio input from a device such as a computer or an audio receiver.

Explanation: Hope this helps!

What are some examples and non-examples of digital security?

Answers

Answer:

Devices such as a smart card-based USB token, the SIM card in your cell phone, the secure chip in your contactless payment card or an ePassport are digital security devices

which of the following is an example of how to effectively avoid plagiarism

Answers

Answer:

You didn't list any choices, but in order to avoid all plagiarism, you must focus on rewriting the following script/paragraph in your own words. This could be anything from completely changing the paragraph (not the context) to summarizing the paragraph in your own words.

Answer:

Simon cites anything that he didnt know before he read it in any given source

Explanation:

a p e x

Write a Python class that inputs a polynomial in standard algebraic notation and outputs the first derivative of that polynomial. Both the inputted polynomial and its derivative should be represented as strings.

Answers

Answer:Python code: This will work for equations that have "+" symbol .If you want to change the code to work for "-" also then change the code accordingly. import re def readEquation(eq): terms = eq.s

Explanation:

Which of the following are complete sets of data and are the rows of the table?
Files
Fields
Queries
Records

Answers

Answer:

I think the answer is going to be records

How should you present yourself online?

a
Don't think before you share or like something
b
Argue with other people online
c
Think before you post
d
Tag people in photos they may not like

hurry no scammers

Answers

C maybe ......,,,,.....

Answer: C) Think before you post.

Explanation:

There's a very good chance that whatever you post online will remain there indefinitely. So it's best to think about what would happen if you were to post a certain message on a public place. Keep in mind that you should also safeguard against your privacy as well.

I want to know the basic of Excel

Answers

Answer:

Use Pivot Tables to recognize and make sense of data.

Add more than one row or column.

Use filters to simplify your data.

Remove duplicate data points or sets.

Transpose rows into columns.

Split up text information between columns.

Use these formulas for simple calculations.

Get the average of numbers in your cells.

What is digital marketing?

Answers

Answer:

Digital marketing is the component of marketing that utilizes internet and online based digital technologies such as desktop computers, mobile phones and other digital media and platforms to promote products and services.

Explanation:

Parts of a computer software

Answers

Answer:

I think application software

utility software

networking software

Ten output devices you know

Answers

Monitor
Printer
Headphones
Computer Speakers
Projector
GPS
Sound Card
Video Card
Braille Reader
Speech-Generating Device

(The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address.A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has

Answers

Answer:

Explanation:

The following code is written in Java and creates all the classes as requested with their variables, and methods. Each extending to the Person class if needed. Due to technical difficulties I have attached the code as a txt file below, as well as a picture with the test output of calling the Staff class.

HURRY- I’ll give 15 points and brainliest answer!!
How do you insert text into a presentation??
By selecting text from the insert menu
By clicking in the task pane and entering text
By clicking in a placeholder and entering text
By drawing a text box clicking in it and entering text
(This answer is multiple select)

Answers

Answer:

the last one the drawing thingy:)))

Use the drop-down menus to answer questions about the options in the Window group. Which command allows a user to view presentations side by side? Which command allows a user to show one presentation overlapping another? Which command allows a user to jump from one presentation to another?

Answers

Answer:

Look at the attached file for the correct answer to  this question on edge:

Explanation:

The command allows a user to jump from one presentation to another Switch windows.

What is Switch windows?

Flip is similar to the Task view feature, although it operates somewhat differently. Click the Task view button in the taskbar's lower-left corner to launch Task view.

As an alternative, you can use your keyboard's Windows key and Tab. You can click on any open window to select it from a list of all your open windows.

It may be challenging to view the desktop if you have many windows open at once. When this occurs, you can minimize all currently open windows by clicking the taskbar's bottom-right corner. Simply click it once again to bring back the minimized windows.

Therefore, The command allows a user to jump from one presentation to another Switch windows.

To learn more about Windows, refer to the link:

https://brainly.com/question/13502522

#SPJ3

Write an application that combines several classes and interfaces.

Answers

Answer:

Explanation:

The following program is written in Java and it combines several classes and an interface in order to save different pet objects and their needed methods and specifications.

import java.util.Scanner;

interface Animal {

   void animalSound(String sound);

   void sleep(int time);

}

public class PetInformation {

   public static void main(String[] args) {

       Scanner scnr = new Scanner(System.in);

       String petName, dogName;

       String dogBreed = "null";

       int petAge, dogAge;

       Pet myPet = new Pet();

       System.out.println("Enter Pet Name:");

       petName = scnr.nextLine();

       System.out.println("Enter Pet Age:");

       petAge = scnr.nextInt();

       Dog myDog = new Dog();

       System.out.println("Enter Dog Name:");

       dogName = scnr.next();

       System.out.println("Enter Dog Age:");

       dogAge = scnr.nextInt();

       scnr.nextLine();

       System.out.println("Enter Dog Breed:");

       dogBreed = scnr.nextLine();

       System.out.println(" ");

       myPet.setName(petName);

       myPet.setAge(petAge);

       myPet.printInfo();

       myDog.setName(dogName);

       myDog.setAge(dogAge);

       myDog.setBreed(dogBreed);

       myDog.printInfo();

       System.out.println(" Breed: " + myDog.getBreed());

   }

}

class Pet implements Animal{

   protected String petName;

   protected int petAge;

   public void setName(String userName) {

       petName = userName;

   }

   public String getName() {

       return petName;

   }

   public void setAge(int userAge) {

       petAge = userAge;

   }

   public int getAge() {

       return petAge;

   }

   public void printInfo() {

       System.out.println("Pet Information: ");

       System.out.println(" Name: " + petName);

       System.out.println(" Age: " + petAge);

   }

   //The at (email symbol) goes before the Override keyword, Brainly detects it as a swearword and wont allow it

   Override

   public void animalSound(String sound) {

       System.out.println(this.petName + " says: " + sound);

   }

//The at (email symbol) goes before the Override keyword, Brainly detects it as a swearword and wont allow it

  Override

   public void sleep(int time) {

       System.out.println(this.petName + " sleeps for " + time + "minutes");

   }

}

class Dog extends Pet {

   private String dogBreed;

   public void setBreed(String userBreed) {

       dogBreed = userBreed;

   }

   public String getBreed() {

       return dogBreed;

   }

}

The function below takes one parameter: an integer (begin). Complete the function so that it prints every other number starting at begin down to and including 0, each on a separate line. There are two recommended approaches for this: (1) use a for loop over a range statement with a negative step value, or (2) use a while loop, printing and decrementing the value each time.

1 - def countdown_trigger (begin):
2 i = begin
3 while i < 0:
4 print(i)
5 i -= 1 Restore original file

Answers

Answer:

Follows are code to the given question:

def countdown_trigger(begin):#defining a method countdown_trigger that accepts a parameter

   i = begin#defining variable that holds parameter value

   while i >= 0:#defining while loop that check i value greater than equal to0

       print(i)#print i value

       i -= 2  # decreasing i value by 2  

print(countdown_trigger(2))#calling method

Output:

2

0

None

Explanation:

In this code, a method "countdown_trigger" is declared, that accepts "begin" variable value in its parameters, and inside the method "i" declared, that holds parameters values.

By using a while loop, that checks "i" value which is greater than equal to 0, and prints "value" by decreasing a value by 2.


State
any three (3) reasons why users attach speakers to their computer?

Answers

Answer:

To complete the computer setup, to hear audio, to share audio.

Explanation:

A computer is not really complete without speakers.

So that you can actually hear the computer's audio.

So that you can have multiple people hear the same audio. (Headphones do not do this)

d) State any three (3) reasons why users attach speakers to their computer?​

Answers

Answer:

the purpose of speakers is to produce audio output that can be heard by the listener. Speakers are transducers that convert electromagnetic waves into sound waves. The speakers receive audio input from a device such as a computer or an audio receiver.

Explanation: Hope this helps!

You will write code to manipulate strings using pointers but without using the string handling functions in string.h. Do not include string.h in your code. You will not get any points unless you use pointers throughout both parts.
You will read in two strings from a file cp4in_1.txt at a time (there will be 2n strings, and you will read them until EOF) and then do the following. You alternately take characters from the two strings and string them together and create a new string which you will store in a new string variable. You may assume that each string is no more than 20 characters long (not including the null terminator), but can be far less. You must use pointers. You may store each string in an array, but are not allowed to treat the string as a character array in the sense that you may not have statements like c[i] = a[i], but rather *c *a is allowed. You will not get any points unless you use pointers.
Example:
Input file output file
ABCDE APBQCRDSETFG
PQRSTFG arrow abcdefghijklmnopgrstuvwxyz
acegikmoqsuwyz
bdfhjlnprtvx

Answers

Solution :

#include [tex]$< \text{stdio.h} >$[/tex]

#include [tex]$< \text{stdlib.h} >$[/tex]

int [tex]$\text{main}()$[/tex]

{

[tex]$\text{FILE}$[/tex] *fp;

[tex]$\text{fp}$[/tex]=fopen("cp4in_1.txt","r");

char ch;

//while(1)

//{

while(!feof(fp))

{

char *[tex]$\text{s1}$[/tex],*[tex]$\text{s2}$[/tex],*[tex]$\text{s3}$[/tex];

[tex]$\text{s1}$[/tex] = (char*) [tex]$\text{malloc}$[/tex]([tex]$20$[/tex] * [tex]$\text{sizeof}$[/tex](char));

[tex]$\text{s2}$[/tex] = (char*) [tex]$\text{malloc}$[/tex]([tex]$20$[/tex] * [tex]$\text{sizeof}$[/tex](char));

[tex]$\text{s3}$[/tex] = (char*) [tex]$\text{malloc}$[/tex]([tex]$40$[/tex] * [tex]$\text{sizeof}$[/tex](char));

[tex]$\text{int i}$[/tex]=0,j=0,x,y;

while(1)

{

ch=getc(fp);

if(ch=='\n')

break;

*(s1+i)=ch;

i++;

}

while(1)

{

ch=getc(fp);

if(ch=='\n')

break;

*(s2+j)=ch;

j++;

}

for(x=0;x<i;x++)

{

*(s3+x)=*(s1+x);

}

for(y=0;y<j;x++,y++)

{

*(s3+x)=*(s2+y);

}

for(x=0;x<i+j;x++)

{

printf("%c",*(s3+x));

}

printf("\n");

getc(fp);

}

}

If you want to continue working on your web page the next day, what should you do?

a. Create a copy of the file and make changes in that new copy

b. Start over from scratch with a new file

c. Once a file has been saved, you cannot change it

d. Reopen the file in your text editor to

Answers

Answer:

d. Reopen the file in your text editor

Answer:

eeeeeeeee

Explanation:

Other Questions
What was the first capital(s) of Florida?TallahasseeTallahassee and St. AugustinePensacola and St. AugustineTallahassee and Pensacola. Please Ill give BRAINLY just help Please help Ill mark you as brainliest if correct! What is the area of the triangle? Write the equation of line AB in slope-intercept form, given the points A(0,5) and B(-5,-10) . In your final answer, include all of your calculations. which of the following is equal to the rational expression? The graphic organizer includes facts about Great Britain and Japan.Column A: Great Britain Column B: JapanThe British Empire stretched across Asia, Africa, and the Pacific. Japan expanded into Manchuria between 1930 and 1939.A student made this graphic organizer to help write an informative essay. What fact could be added to either column?Imported cotton came from colonies in Egypt and India.Diamond-mining companies were built in South Africa.An island nation with a strong navy is easier to defend.A relationship with China strengthened the region. How did Enlightenment ideas affect the government of France? It led to popular legal reforms. It inspired the separation of powers. It led people to revolt against the government. It led to separating the church from government. Detoxification is the process of __________.A.receiving counseling for drug addictionB.using medication to build tolerance to addictive drugsC.managing addictive and self-destructive behaviorD.weaning a body from an addictive drugAnswer: The Answer is D does anyone know how to change these sentences to present tense??!! If a 28.0 L balloon with a temperature of25 C is cooled in a refrigerator, what willbe the volume of the balloon be when itreaches 5 C? Plz help me in math problem Its easy I just want to know how to solve this equation. Question 11 of 25What is the solution to this inequality?X/12 +3 =48B. X=81D. X Certain prehistoric events led to the formation of oil. Which of the following was one of those events? A giant wind storms destroy forests. B glaciers melted at the north and south poles . C Life in the sea died and was buried under sediment. D heavy flooring soaked the earths crust. Identify the angle relationship. Which equation can be used to solve for x?(4x + 1)170 The author warns that video ads will. Students on the field. The ads will help the school , but hes not sure it's worth it. DETERMINE CHRONOLOGY What events on the Atlantic Ocean heightened U.S.-German tensions to near-conflict? When you drop the original ending from a verb in the infinitive form, what are you left with?Group of answer choicesthe branchthe treethe stemthe boot HelpppppppppppppppoooppppppPsnsndnnddnjdjd The retail price of a television set is $2500. If the buyer pays cash, the price is 10% below the retail price. If the set is bought on hire purchase, the buyer pays a downpayment of $500 and 18 monthly installments of $150.A) Determine the difference between the hire purchase price and the cash price.B) Calculate the difference as a percentage of the retail price.