Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 5 a & b Find the Errors 10 points Each of the class declarations and/or member function definitions below has syntax error(s). Find every

Lab 5 a & b Find the Errors 10 points

Each of the class declarations and/or member function definitions below has syntax error(s).

Find every error.

In this lab 5 consist of 10 questions and each question worth 1 point. Each unidentified error will deduct 0.5 point up to one (1) point deduction per qeuestion.

* Hint: You may use compiler to help you find the error. However, you need to set up the program correctly and to point out the true cause of the syntax error. Because the compiler messages are convoluted, due to the convoluted nature of language dependencies.

Part-a Chapter 14 More About Classes

Review Question and Exercises - Find the error (on p. 882/898 of 8th/9th Edition) 59.

class Box { private: double width; double length; double height; public: Box(double w, l, h) { width = w; length = l; height = h; } Box(Box b) {// Copy constructor width = b.width; length = b.length; height = b.height; } ... Other member functions follow ... }; 

60.

class Circle { private: double diameter; int centerX; int centerY; public: Circle(double d, int x, int y) { diameter = d; centerX = x; centerY = y; } // Overloaded = operator void Circle=(Circle &right) { diameter = right.diameter; centerX = right.centerX; centerY = right.centerY; } ... Other member functions follow ... }; 

61.

class Point { private: int xCoord; int yCoord; public: Point (int x, int y) { xCoord = x; yCoord = y; } // Overloaded + operator void operator+(const &Point right) { xCoord += right.xCoord; yCoord += right.yCoord; } ... Other member functions follow ... }; 

62.

class Box { private: double width; double length; double height; public: Box(double w, l, h) { width = w; length = l; height = h; } // Overloaded prefix ++ operator void operator++() { ++width; ++length;} // Overloaded postfix ++ operator void operator++() { width++; length++;} ... Other member functions follow ... }; 

63.

class Yard { private: float length; public: yard(float l) { length = l; } // float conversion function void operator float() { return length; } ... Other member functions follow ... }; 

Part-b Chapter 15 Inheritance, Polymorphism & Virtual Functions

Review Question and Exercises - Find the error (on p. 962/980 of 8th/9th Edition)

54.

class Truck, public : Vehicle, protected { private: double cargoWeight; public: Truck(); ~Truck(); }; 

55.

class SnowMobile : Vehicle { protected: int horsePower; double weight; public: SnowMobile(int h, double w), Vehicle(h) { horsePower = h; } ~SnowMobile(); }; 

56.

class Table : public Furniture { protected: int numSeats; public: Table(int n) : Furniture(numSeats) { numSeats = n; } ~Table(); }; 

57.

class Tank : public Cylinder { private: int fuelType; double gallons; public: Tank(); ~Tank(); void setContents(double); void setContents(double); 

58.

class Three : public Two : public One { protected: int x; public: Three(int a, int b, int c), Two(b), Three(c) { x = a; } ~Three(); }; 

Submit:

All errors with explanation. Pls explain every error there is, explain why it is error and give a solution to it. DO NOT JUST CORRECT IT, EXPLAIN WHAT THE ERROR IS, WHY IS IT ERROR AND PROVIDE THE SOLUTION TO IT!

Note: The objective of this exercise review your understanding is correct. Please to find the error without the compiler help first.

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

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago