In C++ Find the five errors. For each error, state the line number, explain the error and show a correction. #include #include using namespace std; class colorCode { public:      void setRGB(int); //accepts an int parameter and sets the RGB to the value of the parameter      void setName(string);//accepts a string parameter and sets the name of the object to the value of the parameter      string getName() const;//returns the name of the object      int getRGB() const;//returns the RGB of the object      void changeColor();// adds 10 to the RGB value private:      string name;      int RGB; } int main() {      colorCode paintCans[10];      int i;      for (i = 0; i < 10; i++){           paintCans.setRGB[i] = 0;}      paintCans[5].setName(GREEN);      paintCan[5].setRGB(192000);      cout << paintCans[5].getName << ' ' << paintCans[5].getRGB() << endl; return 0; }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In C++

Find the five errors. For each error, state the line number, explain the error and show a correction.

  1. #include<iostream>
  2. #include<iomanip>
  3. using namespace std;
  4. class colorCode
  5. {
  6. public:
  7.      void setRGB(int); //accepts an int parameter and sets the RGB to the value of the parameter
  8.      void setName(string);//accepts a string parameter and sets the name of the object to the value of the parameter
  9.      string getName() const;//returns the name of the object
  10.      int getRGB() const;//returns the RGB of the object
  11.      void changeColor();// adds 10 to the RGB value
  12. private:
  13.      string name;
  14.      int RGB;
  15. }
  16. int main()
  17. {
  18.      colorCode paintCans[10];
  19.      int i;
  20.      for (i = 0; i < 10; i++){
  21.           paintCans.setRGB[i] = 0;}
  22.      paintCans[5].setName(GREEN);
  23.      paintCan[5].setRGB(192000);
  24.      cout << paintCans[5].getName << ' ' << paintCans[5].getRGB() << endl;
  25. return 0;
  26. }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY