Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

b) A graphical user interface is being developed that displays basics shapes on the screen. There are three classes that a programmer has been



b) A graphical user interface is being developed that displays basics shapes on the screen. There are three

b) A graphical user interface is being developed that displays basics shapes on the screen. There are three classes that a programmer has been tasked to design: shape, square, and circle. shape should be an abstract class and square and circle are concrete (i.e. not abstract) subclasses of shape. To hold the size information, each class has a protected field length of type float. The value of this field is only stored in the shape class and its value is initially set by the three constructors. Each class also has a getter and a setter method. All three classes have a function float calculateArea (). In the class shape this is defined as virtual float calculateArea () const = 0; The function returns length*length for square and 3.14*length for the circle class. i) Write the classes described above in C++. ii) In the calculateArea definition explain the meaning of the following parts: virtual, float, const and =0. [8 marks] [4 marks]

Step by Step Solution

3.36 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

This prompt appears to be a part of an assignment or an exam relating to objectoriented programming in C Below Ill address the two parts of the questi... 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

Systems analysis and design

Authors: Alan Dennis, Barbara Haley Wixom, Roberta m. Roth

5th edition

978-1118057629, 1118057627, 978-111880817

More Books

Students also viewed these Programming questions

Question

Discuss the role users play in testing.

Answered: 1 week ago