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]
3 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]3 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
In 1981, Ian Murphy broke into the AT&amp;T online computer system and changed their clocks, allowing people to make calls durin
poizon [28]
A. intentionally or recklessly disrupt, degrade, or destroy information or services on the computer
5 0
2 years ago
Just take points, this website is so weird because of all the reporting and I didn't do any thing
krok68 [10]

Answer:

I agree with you! And thank you for the points

Explanation:

I answer educational questions and ask one of my own regarding math and it gets reported

Someone asked if their art was good and how they can improve it and it gets reported

But the only questions they don’t report are free po!nts

For the people who don’t have anything better to do then report people trying to get help: STOP ITS ANNOYING NOT JUST FOR ME BUT THE PEOPLE WHO ARE TRYING TO GET HELP, INSTEAD OF REPORTING WHY DONT U HELP PEOPLE???

7 0
2 years ago
Read 2 more answers
Consider the following Stack operations:
maxonik [38]

Answer:

Sequence of popped values: h,s,f.

State of stack (from top to bottom): m, d

Explanation:

Assuming that stack is  initially empty. Suppose that p contains the popped values. The state of the stack is where the top and bottom are pointing to in the stack. The top of the stack is that end of the stack where the new value is entered and existing values is removed. The sequence works as following:

push(d) -> enters d to the Stack

Stack:  

d ->top

push(h) -> enters h to the Stack

Stack:

h ->top

d ->bottom

pop() -> removes h from the Stack:

Stack:

d ->top

p: Suppose p contains popped values so first popped value entered to p is h

p = h

push(f) -> enters f to the Stack

Stack:

f ->top

d ->bottom

push(s) -> enters s to the Stack

Stack:

s ->top

f

d ->bottom

pop() -> removes s from the Stack:

Stack:

f ->top

d -> bottom

p = h, s

pop() -> removes f from the Stack:

Stack:

d ->top

p = h, s, f

push(m) -> enters m to the Stack:

Stack:

m ->top

d ->bottom

So looking at p the sequence of popped values is:

h, s, f

the final state of the stack:

m, d

end that is the top of the stack:

m

6 0
3 years ago
How many Little mermaid movies are there? I know there is little mermaid 1 and 2, but I am not sure how many total movies there
kupik [55]
There have only been 3 Little Mermaid movies. 

<span>1. The Little Mermaid (1989) </span>
<span>2. The Little Mermaid 2 Return to the Sea (2000) </span>
<span>3. The Little Mermaid 3 Ariel's Beginning (2008)

hope this helps you(:

if not plz let me know (:

have a good day 
-denis</span>
7 0
3 years ago
Read 2 more answers
The timer is running in the up mode with a period of 800 cycles. Channel 1 engages the output mode (Set/Reset) and sets its regi
Soloha48 [4]

Answer:

Explanation:

Part a)

_______________ ____________ _____________ ___

TAR | /\ \/ /\ \/ /\

|//////////|____________|____________|_____________|__________|

0 600 800 600 800 600

PWM Duty Cycle = 200/800 = 25%

Part b)  

______________ _________________ _________ _________________

TAR | \/ /\ \/ /\ \/

|//////////|_________|_________________|__________| _______________|

0 600 800 600 800 600

PWM Duty Cycle = 600/800 = 75%

7 0
3 years ago
Other questions:
  • Which of the following should you always wear to avoid being thrown from a vehicle and then crushed if it tips over?
    12·2 answers
  • This type of connection uses radio waves to connect devices on a network.
    15·2 answers
  • Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". let's define a singleton to be a data eleme
    5·1 answer
  • Robert is leading a project online that includes students from different cultures. Two of the students spend most of the time li
    7·1 answer
  • JAVA Code:
    14·1 answer
  • Select the correct answer.
    12·2 answers
  • What are some pros for having your phone during school hours?
    10·2 answers
  • Http://www.alegrium.com/sgi/2/eibder
    5·1 answer
  • Which term describes a visual object such as a picture a table or text box
    15·2 answers
  • Lindsey also needs to calcite the commissions earned each month. If the company earns $200,000 or more in a month, the commissio
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!