\"color:rgb(68,68,68);font-family:\'Lucida grande\', Arial, Verdana, sans-serif;
ID: 3535801 • Letter: #
Question
"color:rgb(68,68,68);font-family:'Lucida grande', Arial, Verdana, sans-serif;font-size:small;">
Class TwoNumbers
"color:rgb(68,68,68);font-family:'Lucida grande', Arial, Verdana, sans-serif;font-size:small;" />
"color:rgb(68,68,68);font-family:'Lucida grande', Arial, Verdana, sans-serif;font-size:small;">
Please see attached file.
"color:rgb(68,68,68);font-family:'Lucida grande', Arial, Verdana, sans-serif;font-size:small;" />
"color:rgb(68,68,68);font-family:'Lucida grande', Arial, Verdana, sans-serif;font-size:small;">
Complete the whole program by writing your own TwoNumbers
Class.
"color:rgb(68,68,68);font-family:'Lucida grande', Arial, Verdana, sans-serif;font-size:small;">
// This program demonstrates C++ class concept
#include
#include
using namespace std;
class TwoNumbers
{
private:
int n1, n2;
double avg, sum, product;
.
.
.
};
int main()
{
// Create a TwoNumbers objects.
TwoNumbers N1(39500, 673), N2;
N1.average(); //
calculate average, then assign to private variable
avg
N1.add();
// calculate total, then assign to private variable
sum
N1.multiply(); //
calculate multiplication, then assign to private variable
product
N1.print();
// print object info
N2.setNumber1(50);
N2.setNumber2(5);
N2.average();
N2.add();
N2.multiply();
N2.print();
// print object info
// create object N3 and assign the
two numbers by using the formula given below
TwoNumbers N3(N1, N2); // (N1.num1 +
N2.num1) (N1.num2 + N2.num2)
N3.average();
N3.add();
N3.multiply();
N3.print();
// print object info
system("pause");
return 0;
}
Explanation / Answer
THIS WILL HELP YOU
You have a random asterisk character in your code in the second while loop. You are also missing two semicolons in PHP statements on this line:
and this line
If that doesn't fix your error, then right after the includes, you have:
It is a string that is not assigned to anything. It maybe causing your error. Take that out and try. If that is not the source of your problems, then look where you have:
I would instead add a dot in between the array variable and the rest of the string so it would become:
I would make this update in the multiple places where you do this.
Also, the extra PHP tags after first while loop are really unnecessary. You can just close the while loop normally. So instead of:
You could try:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.