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
klio [65]
3 years ago
14

Write a C++ function for the following:

Computers and Technology
1 answer:
Nana76 [90]3 years ago
4 0

Solution :

class Account

$ \{ $

public:

$\text{Account}()$;

double $\text{getBalance}$();

void $\text{setBalance}$();

$\text{bool withdraw}$(double bal);

$\text{private}:$

double $\text{balance}$;

}:

$\text{Account}()$ {}

double $\text{getBalance}$()

$ \{ $

$\text{return balance}$;

}

void $\text{setBalance}$(double $\text{balance}$)

$ \{ $

this.$\text{balance}$ = $\text{balance}$;

}

$\text{boolean}$ withdraw($\text{double bal}$)

$ \{ $

if($\text{balance}$ >= bal)

$ \{ $

$\text{balance}$ = $\text{balance}$ - bal;

$\text{return}$ true;

}

$\text{return}$ false;

}

}

You might be interested in
Which componet is the smallest unit in a spreadsheet
goblinko [34]

The cell is the smallest unit in a spreadsheet

4 0
3 years ago
Hlo plss help.<br>.....,, ​
vladimir1956 [14]

Answer:

please sulto garera kichnu hola

5 0
3 years ago
Read 2 more answers
One metric ton is approximately 2,205 pounds.
goldfiish [28.3K]

Answer:

Here is the C++ program

#include <iostream>  

using namespace std;  

int main(){

 double tonne = 2205;  

 double container_capacity;      

  cout << "Enter amount of wheat in pounds that a contained can hold: ";

  cin >> container_capacity;    

  cout << "Number of containers needed to store one metric ton of wheat: " << tonne / container_capacity ; }        

Explanation:

  • In the body of main function, the first statement declares a double type variable tonne and assigns it a value of 2205 as it is given in the question that one metric ton is equal to 2205 pounds approx.  Metric ton is also called tonne that's why i used tonne variable name in the program.
  • Next statement declares the variable container_capacity which stores the amount of wheat a container can hold.
  • Next the program prompts the user to enter amount of wheat that a container can hold.
  • Next statement stores that input value (amount of wheat that container can hold).
  • Last statement calculates and outputs the no. of containers required to store a tonne of wheat.
  • The formula divides the value of one tonne i.e. 2205 by the capacity of the container to get no. of containers required to store one tonne of wheat.
  • Suppose the container_capacity= 500
  • So number of containers needed to store one metric ton of wheat is

                      tonne / container_capacity = 2205/500 = 4.41

7 0
3 years ago
Write a function called calculate() that accepts three integer Numbers as arguments, compute these values : Sum and Product and
Dmitrij [34]

Answer:

int* calculate(int a,int b,int c){

   int result[] = {0,0};

   int sum = a+b+c;

   int product = a*b*c;

   result[0] = sum;

   result[1] = product;

   return result;

}

Explanation:

The function is a block of the statement which performs the special task.

The function can return one integer, not more than one integer.

If we want to return multiple values then, we can use array.

we store the result in the array and return that array to the main function.

This is the only possible way to return multiple values.

So, define the function with return type array and declare the array with zero value.

Then, calculate the values and store in the variable after that, assign to the array.

Finally, return that array.  

5 0
3 years ago
"someone has tampered with your computer and erased data". what kind of computer threat is this
pishuonlain [190]
<span>So if some access your computer and erased some data without your permission or knowing then this threat is called as security threat. So you should have these stand alone systems with username and password concept that would protect your sensitive and private data and have the control over your computer.</span>
4 0
3 years ago
Other questions:
  • Describe in detail how to determine if a source is credible when conducting research. Justify your response using two or more co
    8·1 answer
  • Mary needs to choose the _____ menu in order to place the text in a desirable fashion around the image
    12·2 answers
  • While waiting to be seated at a restaurant, Jason receives a customer loyalty coupon through an app on his mobile phone for half
    7·1 answer
  • Which command will display each line in the text file based on the alphabet?
    10·1 answer
  • Which of the following is not a compilation error? Group of answer choices a. Placing a semicolon at the end of the first line o
    13·1 answer
  • which of these variable declarations will the variable remain uninitialized unless it is explicitly initialized?1)Declaration of
    5·1 answer
  • Help me! I’ll mark you brainly
    13·1 answer
  • c) If you are at foreign country visit, which banking card would you prefer to keep with you during visit (Debit Card or Credit
    10·1 answer
  • Use the drop-down menus to complete the sentences about the Calendar view Arrange command group.
    6·1 answer
  • Which html tag designates links to other web pages?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!