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
​ A wire service is also known as a ____.
charle [14.2K]
The answer is C press agency
4 0
3 years ago
Click this link to view O NET'S Wages and Employment section for Film and Video Editors.
soldier1979 [14.2K]

Answer: much faster than average (11% or higher)

Explanation:

7 0
3 years ago
Read 2 more answers
In PKI, the CA periodically distributes a(n) _________ to all users that identifies all revoked certificates.
Trava [24]

Answer:

" CRL (certificate revocation list)" is the appropriate answer.

Explanation:

  • A collection of such subscriber bases containing accreditation or certification status combined with the validation, revocation, or outdated certification within each final customer is known as CRL.
  • Only certain subscribing workstations with a certain underlying cause authentication system should have been duplicated.
4 0
3 years ago
What is the difference between the default constructor and the overloaded constructor?
lukranit [14]

Explanation:

A default constructor is a constructor that present in the class by default with no parameters when we write a new constructor with parameters it is called overloaded constructor.There can be different overloaded constructors in the same class.

The main difference between default constructor and overloaded constructor is that the default constructor does't have any parameters while the overloaded constructors have parameters.

4 0
3 years ago
17. Write a SELECT query for the palateE4 database that produces a result grid listing paintName, and a count of the occurrences
GaryK [48]

Answer:

SELECT paintname, COUNT(paintname) as count_paintname

FROM paint

GROUP BY paintname HAVING COUNT(paintname) > 2

ORDER BY paintname

Explanation:

The structured query language or SQL statement returns two columns of paintname and the count of the distinct paint names in the paint table with rows of grouped paint names greater than two and in the ascending order of the names.

4 0
2 years ago
Other questions:
  • Chris needs to modify the default bullets that are used in a nonnumbered list in word. Which method should he use?
    9·2 answers
  • "the ____ criteria filter requires the records displayed to have the specified text string anywhere."
    11·1 answer
  • Technology has proliferated in Kenya and Somaliland, with text messages used to replace cash, creating mobile money use that, on
    11·1 answer
  • How many passes will it take to find the five in this list?
    14·2 answers
  • Write an algorithm to display your name 10 times​
    5·1 answer
  • Need the answer ASAP plz !!!!!
    7·1 answer
  • What is algorithm and how does it works​
    11·2 answers
  • Can you explain the difference between software and hardware? Tell me 3 examples of each one.
    10·1 answer
  • ANs and WANs can be set up in several different shapes, also known as peripherals.
    6·1 answer
  • you want to run your campaign for your dry-cleaning service across three different publishers, each with different video creativ
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!