Access Millions of academic & study documents

All these questions are numbered They are all questions about C++

Content type
User Generated
Showing Page:
1/31
All these questions are numbered. They are all questions
about C++. If someone could answer them all and
correspond the answer with the question number that
would be awesome!!! Thanks!
1)
What is the output of the following function and function
call?
void main(){
void calculateCost(int count, float& subTotal, float
taxCost);
float tax = 0.0,
subtotal = 0.0;
calculateCost(15, subtotal,tax);
cout << \"The cost for 15 items is \" << subtotal
<< \", and the tax for \" << subtotal << \" is \" << tax <<
endl;
}
void calculateCost(int count, float& subTotal, float
taxCost)
{
if ( count < 10)
{
subTotal = count * 0.50;
}
else
{
subTotal = count * 0.20;
}
taxCost = 0.1 * subTotal;
}
A) The cost for 15 items is 3.00, and the tax for 3.00 is

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/31
0.30;
B) The cost for 15 items is 0.00, and the tax for 3.00 is
0.00;
C) The cost for 15 items is 0.00, and the tax for 3.00 is
0.30;
D) The cost for 15 items is 3.00, and the tax for 3.00 is
0.00;
--------------------------------------------------------------------------
-------------------------------
2)
Given the following class declaration:
class Rational
{
public:
Rational();
Rational(int numer, int denom);
int getNumerator() const;
int getDenominator() const;
friend void display(ostream& out, const Rational& value);
friend bool operator(const Rational& left, const Rational&
right);
private:
int numerator;
int denominator;
//what must we add to the class in order for the following
code to compile?
Rational myRational(2,3);
if (3 < myRational)
A) We need another < operator that expects an integer as
the second parameter.
B) We need another < operator that expects an integer as
the first parameter.
C) We need a constructor that expects a ration number.
D) We need a constructor that expects an integer.
E) A or D

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/31

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 31 pages?
Access Now
Unformatted Attachment Preview
All these questions are numbered. They are all questions about C++. If someone could answer them all and correspond the answer with the question number that would be awesome!!! Thanks! 1) What is the output of the following function and function call? void main(){ void calculateCost(int count, float& subTotal, float taxCost); float tax = 0.0, subtotal = 0.0; calculateCost(15, subtotal,tax); cout ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4