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
Colt1911 [192]
4 years ago
9

Consider the following statements: #include #include class Temporary { private: string description; double first; double second;

public: Temporary(string = "", double = 0.0, double = 0.0); void set(string, double, double); double manipulate(); void get(string&, double&, double&); void setDescription(string); void setFirst(double); void setSecond(double); }; Write the definition of the member function set() so that the instance variables are set according to the parameters. Write the definition of the constructor so that it initializes the instance variables using the function set() Write the definition of the member function manipulate() that returns a decimal number (double) as follows: If the value of description is "rectangle", it returns first * second If the value of description is "circle" it returns the area of a circle with radius first if the value of description is "cylinder" it returns the volume of a cylinder with radius first and height second. HINT: the volume of a cylinder is simply the area of the circle at the base times the height. If the value of description is "sphere" it returns the volume of the sphere with radius first. Otherwise it returns -1.0;
Computers and Technology
1 answer:
Anna007 [38]4 years ago
6 0

#include <iostream>  

#include <iomanip>  

using namespace std;  

class temporary  

{  

public:  

void set(string, double, double);  

void print();  

double manipulate ();  

void get (string&, double&, double&);  

void setDescription(string);  

void setFirst(double);  

void setSecond(double);  

string getDescription() const;  

double getFirst () const;  

double getSecond () const;  

temporary(string = "", double = 0.0, double = 0.0);  

private:  

string description;  

double first;  

double second;  

};  

void temporary::set(string a, double dblA, double dblB)  

{  

description = a;  

first = dblA;  

second = dblB;  

}  

void temporary::print()  

{  

cout << "\nDescription: " << left << setw(20) << description << endl <<  

" first: " << fixed << setw(10) << setprecision(2) << first << endl <<  

" second: " << fixed << setw(10) << setprecision(2) << second << endl;  

}  

double temporary::manipulate()  

{  

return first / 3.0 + second / 4.0;  

}  

void temporary::get(string& strDesc, double& dblFirst, double& dblSecond)  

{  

strDesc = description;  

dblFirst = first;  

dblSecond = second;  

}  

temporary::temporary(string d, double a, double b) : description(d), first(a), second(b) {}  

void temporary::setFirst(double dblFirst){first = dblFirst;}  

void temporary::setSecond(double dblSecond){second = dblSecond;}  

void temporary::setDescription(string desc){description = desc;}  

string temporary::getDescription() const {return description;}  

double temporary::getFirst () const{return first;}  

double temporary::getSecond () const {return second;}  

int main()  

{  

cout << "temporary a;";  

temporary a;  

a.print();  

cout << "a.setFirst(3.0): ";  

a.setFirst(3.0);  

a.print();  

cout << "a.setSecond(4.5): ";  

a.setSecond(4.5);  

a.print();  

cout << "a.setDescription(\"Picture Frame\") ";  

a.setDescription("Picture Frame");  

a.print();  

cout << "a.print(): ";  

a.print();  

return 0;  

}

You might be interested in
Which of the following is NOT considered a digital assets
sweet [91]

Answer:

D. An image you do not have the right to use

Explanation:

Since you don't have the rights to use the image it isn't considered a digital asset.

3 0
3 years ago
The principle of time preference requries a larger payment in the future than the present. Which situation best illustrates this
gladu [14]
The answer is letter C.
3 0
3 years ago
Write a program to do the following: Load $t0 with 12 and call it x. Load 21 in $t1 and denote it as y. Finally, load 32 in $t2
ELEN [110]

Answer:

addi $t0, $zero, 12

addi $t1, $zero, 21    

addi $t2, $zero, 32    

addi $t3, $zero, 3

mul $t3, $t3, $t0

mul $t3, $t3, $t0  

addi $v, $zero, 10

mul $v, $v, $t1  

addi $w, $zero, 5

mul $w, $w, $t2  

add $a0, $t3, $v

add $a0, $a0, $w

addi $v0, $zero, 1

syscall

Explanation:

  • Use the addi statement to initialize the t0, t1 and t2 variables with a 0 value.
  • Use the mul statement to multiply the t0 with t3 and then multiply variable v with t1.
  • Use the add statement to add the variable v with t3 and assign the result to a0 variable.
  • Use the add statement to add the variable w with a0 and assign the result to a0 variable.

3 0
3 years ago
What's a good online University to attended for cyber security certificate.?
IrinaK [193]

Answer:

If your in the UK, a great university to attend is Lancaster University for a cyber security certificate.

Explanation:

8 0
3 years ago
What are the arguments both for and against the exclusive use of Boolean expressions in the control statements in Java (as oppos
dezoksy [38]

Answer:

The correct answer to the following question will be "Primary argument".

Explanation:

The primary argument for the use of Boolean operators or expressions exclusively as regulation expressions seems to be the flexibility resulting from forbidding for the above usage a broad variety of styles.

  • For illustration, in C some statements of a certain sort may present as a command statement so that the compiler sometimes doesn't recognize irregularities in grammatical mistakes that resulted in links to a variable of inappropriate forms.
4 0
3 years ago
Other questions:
  • To track website behavior data with google analytics, which steps will you need to complete?
    14·1 answer
  • When at the rightmost cell in a row, press the ENTER key to move to the first cell in the next row; do not press the TAB key
    6·1 answer
  • How to put vibratuon when tapping on keyboard galaxy s3?
    5·1 answer
  • How to fix delayed responses on Windows computer?
    9·1 answer
  • PLEASE HELP
    11·2 answers
  • Nicole is in a study group to prepare for a test on plant biology, a subject she knows a lot about. During their meetings, she a
    12·2 answers
  • What do the Brainly points do? sorry im new here and i dont know how to internet rn .-.
    7·2 answers
  • What is meant by reflection?​
    9·2 answers
  • True and false 1. Trace topology is also referred to as tree bus topology. ​
    9·1 answer
  • Which of the following includes premium content you must pay to use?<br> On word
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!