1. Homepage
  2. Exam
  3. CPT106 SEMESTER 2021/22 Resit Exam - Question 4

CPT106 SEMESTER 2021/22 Resit Exam - Question 4

This question has been solved
Engage in a Conversation

 
CourseNana.COM

2nd SEMESTER 2021/22 Resit Exam CourseNana.COM

Undergraduate – Year 2 CourseNana.COM

C++ Programming and Software Engineering II CourseNana.COM

Exam Duration:   2 Hours CourseNana.COM

  CourseNana.COM

  CourseNana.COM


CourseNana.COM

  CourseNana.COM

INSTRUCTIONS TO CANDIDATES CourseNana.COM

  CourseNana.COM

1、    This is an open book resit exam. Please complete the exam independently and honestly. CourseNana.COM

2、    The total marks available are 100. CourseNana.COM

3、    Answer all questions in the answer booklet and submit it to LMO. There is NO penalty for providing a wrong answer. CourseNana.COM

4、   The duration is 2 hours. CourseNana.COM


   CourseNana.COM

  CourseNana.COM

Q4 CourseNana.COM

  CourseNana.COM

An abstract class Shape is defined as follows: CourseNana.COM

Total 20 CourseNana.COM

  CourseNana.COM

  CourseNana.COM

class Shape{ public: CourseNana.COM

virtual void print() = 0;//print the shape name  virtual double area() = 0; //return the area of a shape CourseNana.COM

}; CourseNana.COM

An incomplete class Rectangle is defined as follows: CourseNana.COM

class Rectangle: Shape { private: CourseNana.COM

double a, b; public: CourseNana.COM

Rectangle(double x);//a square Rectangle(double x, double y); double area(); CourseNana.COM

void print(); CourseNana.COM

bool operator >=(Rectangle r); bool operator <=(Rectangle r); CourseNana.COM

}; CourseNana.COM

  CourseNana.COM

  CourseNana.COM

a) CourseNana.COM

Complete the definition of the two constructors of class Rectangle. CourseNana.COM

(5) CourseNana.COM

  CourseNana.COM

b) CourseNana.COM

Complete the definition of the overriding functions of class Rectangle. CourseNana.COM

(5) CourseNana.COM

  CourseNana.COM

c) CourseNana.COM

Produce the complete functions for the overloading operators. CourseNana.COM

(5) CourseNana.COM

  CourseNana.COM

d) CourseNana.COM

Write a main() function to test the class Rectangle and Shape. In the main() function, the following are expected to be tested: the two constructors, shape type output, Rectangle’s area and overloading operators. CourseNana.COM

(5) CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Get the Solution to This Question

WeChat WeChat
Whatsapp WhatsApp
CPT106代写,C++ Programming and Software Engineering II代写,C++代写,Software Engineering代写,Exam代写,XTJLU代写,CPT106代编,C++ Programming and Software Engineering II代编,C++代编,Software Engineering代编,Exam代编,XTJLU代编,CPT106代考,C++ Programming and Software Engineering II代考,C++代考,Software Engineering代考,Exam代考,XTJLU代考,CPT106help,C++ Programming and Software Engineering IIhelp,C++help,Software Engineeringhelp,Examhelp,XTJLUhelp,CPT106作业代写,C++ Programming and Software Engineering II作业代写,C++作业代写,Software Engineering作业代写,Exam作业代写,XTJLU作业代写,CPT106编程代写,C++ Programming and Software Engineering II编程代写,C++编程代写,Software Engineering编程代写,Exam编程代写,XTJLU编程代写,CPT106programming help,C++ Programming and Software Engineering IIprogramming help,C++programming help,Software Engineeringprogramming help,Examprogramming help,XTJLUprogramming help,CPT106assignment help,C++ Programming and Software Engineering IIassignment help,C++assignment help,Software Engineeringassignment help,Examassignment help,XTJLUassignment help,CPT106solution,C++ Programming and Software Engineering IIsolution,C++solution,Software Engineeringsolution,Examsolution,XTJLUsolution,