Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

if you have following 5 questions, how you will answer them. This is C++ and I\'

ID: 3812776 • Letter: I

Question

if you have following 5 questions, how you will answer them. This is C++ and I'm just asking you to write, in some cases, snippets of (syntactically correct) code. You do not need to write an entire program.

1.You will have to write a new method for some class we covered. Here, I just expect that you write the method; it doesn't have to be put in the context of class itself, so it's just like writing a single function. Namely, you'll specify a return type, a method name, a (possibly empty) parameter list, curly braces delimiting the body of the function and of course, the body of the function itself. For example,
void foo(int bar) {
// some valid C++ statements
}

2.You will have to write a sequence of C++ statements that realize some specified state or behavior. For example,
statement1;
statement2;
// etc.
// etc.

3.A grammar-related question, that among other things, will require writing a function analogous to the manner present above in 1.

4.Brings out the artist in you; you'll have to draw me some pictures.

5.You'll have to provide the declaration and definition of some method. For example:
// Declare a method requires simply writing a function prototype
void foo(int bar);
// Defining the method requires the use of scope resolution operator:
void SomeClass::foo(int bar) {
// some code
}

Explanation / Answer

HI, I have answered first two Questions.

Please repost others in separate post.

Please let me know in case of any issue in first teo questions.

1)

   double getSum() {
       // declaring two variables of type double
       double x, y;
       // taking user input
       cout<<"Enter two numbers: "<<endl;
       cin>>x>>y;

       //returning sum
       return (x+y);
   }

   Method Name: getSum
   return type: double

2)

   int x = 0; // default value

   x++; // incrementing x by 1

   int y = x + 1; // declaring a new variable y and assigining value equal to (x+1)