Through the completion of this assignment

  

Goals:

Through the completion of this assignment students should familiarize themselves with the creation of an interface. Students should understand the purpose of organizing methods into an interface so that multiple classes can share the same functionality. Students should also note that implementation of an interface provides a simple way for classes to be organized within a single category without the need for complex inheritance, which can be troublesome and easily leads to code rot — software that loses its reusability over time. 

Files to be Submitted:

In this assignment students should create five header classes called Point, Circle, Rectangle, Square, FigureGeometry and one cpp file TestAll. The TestAll class should implement a main method which tests all of the other files created in the assignment. After the assignment has been completed, all six files should be submitted for grading into the Dropbox for Assignment 3, which can be found in the Dropbox menu on the course website. Students should note that only the *.h or .cpp file for each class needs to be submitted.

Please click on each of the following links to view specific requirements for the files that must be created and submitted: (File criteria are listed below)

  1. Requirements: Point.h
  2. Requirements: FigureGeometry.h
  3. Requirements: Circle.h
  4. Requirements: Rectangle.h
  5. Requirements:      Square.h
  6. Requirements: TestAll.cpp 

Tips:

The following code example displays a basic implementation of an interface: 

 //FigureGeometry.h:

#ifndef FIGUREGEOMETRY_H

#define FIGUREGEOMETRY_H

classFigureGeometry

{

private:

public:

FigureGeometry() {}

virtualfloatgetArea() const = 0;

virtualfloatgetPerimeter() const = 0;

};

staticconst float PI = 3.14f;
#endif

Requirements: TestAll.cpp

      

Description:

 

The TestAll     class should be declared as a class and     should meet all the requirements listed below. Its purpose is to implement     a main     method which creates three objects — a Circle     object, a Square     object, and a Rectangle     object — and test each of the files that have been designed for the     Chapter 3 Assignment. 

       

Methods:

 

Modifiers

Return Type

Name

Parameters

Implementation

 

 

void

main

()

Students should already be familiar with how to instantiate     objects and print values to the screen using cout<< . Therefore, the     actual implementation code for this assignment will not be provided.     Students may organize the output of data according to their own     specifications. However, the main     method must perform the following tasks: 

1. Create an instance of Circle, called c1, with a radius of 5. 

2. Create an instance of Square, called s1, with a side length of     5. 

3. Create an instance of Rectangle, called r1, with a width of 5 and a height of 7. 

4. Print the radius of c1.

5. Print the area of c1.

6. Print the perimeter of c1.

7. Print the side length of s1.

8. Print the area of s1.

9. Print the perimeter of s1.

10. Print     the width of r1.

11. Print     the height of r1.

12. Print     the area of r1.

13. Print     the perimeter of r1.

    

Output:

 

Output of the main     method should be similar to the following:
 

Details of c1:
     radius: 5
     area: 78.5
     perimeter: 31.4
 

    Details of s1:
     side length: 5
     area: 25
     perimeter: 20
 

    Details of r1:
     width: 5
     height: 7
     area: 35
     perimeter: 24

Requirements: FigureGeometry.h

      

Description:

 

The FigureGeometry     interface should be declared as a class     FigureGeometry and should meet all the requirements listed below. Its     purpose is to declare all the necessary methods that any geometric figure,     such as a circle, rectangle, or square, should contain. The FigureGeometry interface should also     declare a numeric constant, called PI,     which can be used by classes that include the FigureGeometry interface. Students     should also note that the inclusion of instance variables within an     interface declaration is not allowed; only static constants may be defined     within an interface declaration. 

 

    

Constants:

 

Modifiers

Type

Name

Value

 

static

const float

PI

3.14f

 

    

Methods:

 

Return Type

Name

Parameters

 

float

getArea()

none

 

float

getPerimeter()

none

 

    

Tips:

 

The following coding     example illustrates a version of the FigureGeometry.

ifndef FIGUREGEOMETRY_H_
    #define FIGUREGEOMETRY_H_

 
 

class FigureGeometry

 

{

 

 
 

private:

 

 
 

public:

 

            FigureGeometry() {} //default constructor

 

   /**
         * Classes that implement the FigureGeometry     interface MUST override this
         * method which should return the geometric     area of a figure:
         *
         * In an interface, methods are virtual.
         *
         */
 virtualfloatgetArea() const     = 0;

                               /**
                                *     Remember, all interface methods are virtual,
                                *     and abstract method declarations should always
                                *     end in a semicolon instead of a method body.
                                */

 

   /**
         * Classes that implement the FigureGeometry     interface MUST also override
         * this method which should return the     geometric perimeter of a figure:
         */
           virtualfloatgetPerimeter()     const = 0;

 

    } 

staticconstfloat PI = 3.14f;

#endif

Requirements: Circle.h

      

Description:

 

The Circle     class should be declared as a public     class that includes the FigureGeometry interface described in     the Chapter 3 Assignment sheet and should meet all the requirements listed     below. Its purpose is to store the radius of a circular figure and provide     the methods necessary to calculate the area and perimeter of such a figure.     

       

Variables:

 

Modifiers

Type

Name

Purpose

 

private

float

radius

stores the radius of a Circle     object

       

Constructors:

 

Modifiers

Parameters

Implementation

 

public

float theRadius

initializes the radius of a Circle     object in the following manner:
 

radius = theRadius;

       

Methods:

 

Modifiers

Return Type

Name

Parameters

Implementation

 

public

float

getRadius

none

returns the radius of a Circle     object in the following manner:
 

return radius;

 

virtual

float

getArea

none

returns the area of a Circle     object in the following manner:
 

return getRadius() * getRadius()     * PI; 

 

virtual

float

getPerimeter

none

returns the perimeter of a Circle     object in the following manner:
 

return getRadius() * 2 * PI; 

 

public

void

setRadius

float theRadius

assigns the radius of a Circle     object in the following manner:
 

radius = theRadius;

       

Requirements: Rectangle.h

      

Description:

 

The Rectangle class     should be declared as a public     class that implements the FigureGeometry interface     described in the Chapter 3 Assignment sheet and should meet all the     requirements listed below. Its purpose is to store the Point of a     rectangular figure (using the Point class described in the     Chapter 3 Assignment sheet) and provide the methods necessary to calculate     the area and perimeter of such a figure.

 

    

Variables:

 

Modifiers

Type

Name

Purpose

 

private

Point

point

stores the Point point of     a Rectangle object

 

    

Constructors:

 

Modifiers

Parameters

Implementation

 

public

Point p1;

initializes the Point p1 of a Rectangle object     in the following manner:
 

    point =p1;

 

    

Methods:

 

Modifiers

Return Type

Name

Parameters

Implementation

 

public

int

getWidth

none

returns the width of     a Rectangle object in the following manner:
 

    return point.getWidth();

 

public

int

getHeight

none

returns the height of     a Rectangle object in the following manner:
 

    return point.getHeight();

 

virtual

float

getArea

none

returns the area of     a Rectangle object in the following manner:
 

    return getWidth() * getHeight();

 

virtual

float

getPerimeter

none

returns the perimeter of     a Rectangle object in the following manner:
 

    return ( getWidth() + getHeight() ) * 2;

 

public

void

setPoint

Point p1;

assigns the Point p1 to point:
 

    point= p1;

Requirements: Square.h

      

Description:

 

The Square     class should be declared as a class that     includes the FigureGeometry interface described in     the Chapter 3 Assignment sheet and should meet all the requirements listed     below. Its purpose is to store the Point of a square figure (using the     Point class described in the Chapter 3 Assignment sheet) and provide the     methods necessary to calculate the area and perimeter of such a figure.

       

Variables:

 

Modifiers

Type

Name

Purpose

 

private

Point

point

stores the Point of Square     object

       

Constructors:

 

Modifiers

Parameters

Implementation

 

public

Point p1

initializes the Point of a Square     object in the following manner:
 

point= p1; 

       

Methods:

 

Modifiers

Return Type

Name

Parameters

Implementation

 

public

int

getSideLength

none

returns the side length of a Square     object in the following manner:
 

return point.getWidth();

 

virtual

float

getArea

none

returns the area of a Square     object in the following manner:
 

return getSideLength() *     getSideLength(); 

 

virtual

float

getPerimeter

none

returns the perimeter of a Square     object in the following manner:
 

return getSideLength() * 4; 

 

public

void

setPoint

Point p1

assigns the side length of a Square     object in the following manner:
 

point= p1;

Requirements: Point.h

Description:

The Point class should be declared as a class and should meet all the

requirements listed below. Its purpose is to store the Point (width and

height) of a two-dimensional, rectangular geometric figure.

Variables:

Modifiers TypeName Purpose

Private: intwidth stores the width of a Point object

Private: intheight stores the height of a Point object

Constructors:

Modifiers Parameters Implementation

Public initializes the width and height of a Point object in the following manner:

width = 0;

height = 0;

Public inttheWidth, initializes the width and height of a Point object in the 

InttheHeightfollowing manner: width = theWidth; 

height = theHeight;

Methods:

Modifiers Return Type Name   Parameters  Implementation

Public int getWidth() const none  returns the width of a Point object:

returnwidth;

Public int getHeight() const none returns the height of a point object:

returnheight; 

Public void setWidthint width = theWidth;

theWidth

Public void setHeight int height = theHeight;

theHeight

Calculate the price of your order

Choose an academic level, add pages, and the paper type you want.
To reduce the cost of our essay writing services, select the lengthier deadline.
We can't believe we just said that to you.

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Why is Purdue Papers the Most Helpful Essay Writing Service for You?

  1. Custom-written and plagiarism-free papers: Our authors create their work from scratch. Before presenting them to clients, we routinely verify them for signs of plagiarism. Our quality assurance group also double-checks and fixes any grammatical errors, assuring that all of our authors adhere to the same standards of writing.
  2. The significance of timely delivery cannot be overstated, and we consistently strive to meet or exceed our clients' deadlines. Regardless of the short time frame, you can count on our writers to get the job done. We always have a team of writers ready to go, even if the deadline is only six hours away.
  3. Customer Satisfaction: Our customer service representatives are the best in the business and have a wealth of knowledge in dealing with clients. All our customer service representatives are trained to listen and reply promptly until you are satisfied with their service. To ensure you're happy, our expert writers will strictly follow the criteria to generate a special report. Our customer service may be contacted by chat, email, or phone. In addition, we provide round-the-clock assistance to all of our clients.
  4. Confidentiality: Our systems are safe, and your information is always protected. We're constantly looking for new facts when it comes to finishing your work. We use a safe and secure payment channel. Since our ordering process is completely anonymous, you don't have to provide any credit card information to place a purchase with us.
  5. Highly Trained Authors: Our writers have received extensive training and are committed to delivering only the best papers. They are fluent in APA, MLA, HARVARD, IEEE, CHICAGO, and AMA referencing styles. To meet your expectations, our skilled writers always pay close attention to your instructions.
  6. Lowered prices: We have set prices that are already discounted. Our prices are the best and affordable for all our esteemed customers.

Let Professionals Take Care of your Academic Paper