Computer Science Homework Solutions
Problem
#130946

C++

Using the attached file all numbers class do the following:

- write a template function for the class called Add15() that adds 15 to each of the two numbers and display the result

- write a template function for the class called multiplybypoints5() that multiples 0.5 to each numbers in the parameter list and display result

-write a template function greater()  that adds the two numbers in the parameter list and divides the sum by the greater or the two numbers and display the result

Attached file(s):
Attachments
allnumbers.txt  View File

Attachment Content Summary (Note: view attachment at the above link before purchasing. Actual attachment content may vary slightly from that shown below.)

allnumbers.txt
include #

using namespace std;

void main()

{
allnumbers intnumbers;
allnumbers floatnumbers;

cout<<"using template class for integers....\n";
intnumbers.setvalues(53,91);
cout<<"\n the sum of 53 and 91 is ";
cout< cout<<"\n\n the difference between 53 and 91";
cout<<"is "< cout<<"\n\n the product of 53 and 91 is ";
cout<< intnumbers.multiply();
cout<<"\n\n 53 divided by 91 is ";
cout<< intnumbers.divide()<
cout<<"\n\n\n using template class for floating ";
cout<<"point numbers....\n";
floatnumbers.setvalues(53.4,91.6);
cout<<"\n the sum of 53.4 and 91.6 is ";
cout< cout<<"\n\n the difference between 53.4 and 91.6 is ";
cout<<"is"< cout<<\n\n the product of 53.4 and 91.6 is ";
cout< cout<<"\n\n 53.4 divided by 91.6 is ";
cout<< floatnumbers.divide()<
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$11.97)
Included in Download
  • Plain text response
  • Attached file(s):
    • Numbers.cpp
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Data Structures with C++ Using STL - Write a function template void stackClear (stack& s); that clears a stack s. Why is it critical that s be passed by reference? Please provide a complete program if it makes s ...
  • Queues C++ - Write the definition of the function template moveNthFront that takes as a parameter a queue and a positive integer, n. The function moves the nth element of the queue to the front. The order of the ...
  • Stacks C++ - Write the definition of the function template second that takes as a parameter a stack object and returns the second element of the stack. The original stack remains unchanged.
  • Stack C++ - Stack C++. See attached file for full problem description.
  • Queues C++ - Write a function template, reverseStack, that takes a parameter a stack object and a queue object whose elements are of the same type. The function reverseStack uses the queue to reverse the elements ...
Browse