Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please I need help to fix my program Write code in C++ that has the following characteristics: create a class it should have 2 public

please I need help to fix my program

Write code in C++ that has the following characteristics:

  • create a class
  • it should have 2 public functions - both named add
  • overload the functions
    • one will take 2 arguments
      • a string
      • an integer value
    • one will take 2 arguments
      • a string
      • a float value
    • each function should use the to_string() function to convert the numerical value to a string
    • add the string that was passed in and the newly converted string
    • return the newly created string
  • In main
    • define an instance of the class you have created
    • define a string with the value "CSP ", an integer with a value of 17 and a float with a value of 31.5
    • call the class methodadd()- passing the string value and the integer value
    • print the new string that was returned from the class method
    • call the class methodadd()again - passing the string value and the float value
    • print the new string value that was returned from the class method.

The output should be:

The integer conversion and addition produces CSP 17

The float conversion and addition produces CSP 31.500000

#include using namespace std; class Overloadi { public: int add(string n, i" v:shapes="Picture_x0020_99">

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Combinatorial Testing In Cloud Computing

Authors: Wei-Tek Tsai ,Guanqiu Qi

1st Edition

9811044805, 978-9811044809

More Books

Students also viewed these Programming questions

Question

Find the four complex fourth roots of unity, 1, and plot them.

Answered: 1 week ago