Demonstrate the usage of objects of point class by a client

Assignment Help C/C++ Programming
Reference no: EM132223475

Lab : Point Class

This assignment will provide practice with object-oriented design and coding (classes, objects, constructors, operator overloading, friend functions). The task is to implement a Point class to represent points in a two-dimensional Cartesian coordinate system. To help you understand the required functionality that the class must implement, a driver program is available that demonstrates the usage of objects of Point class by a client. One of the main tasks is to overload several operators that can be used by the client. They are defined as such:

Operator

Functionality

Description

      %

Rotation

Member function that rotates a Point about the origin by the specified number of degrees. Returns a new Point.

_

Distance
(Binary operator)

Member function that calculates the difference between two Points and returns the distance (type double).

^

Midpoint

Member function that calculates the midpoint between two Points. Returns a new Point.

+=

Translation

Add two Points or a Point and a double and returns a reference to the left-hand operand which has been modified. These are both member functions.

-

Translation

Member function that subtracts a double from a Point and returns a new Point.

++

Pre/Post
Increment

Add one to the x/y values of the object. There are two versions, one for pre­and one for post-increment. Pre-increment returns a reference to the incremented Point and post-decrement returns a new Point with the value of the "before incremented point". Both are member functions.

--

Pre/Post
Decrement

Subtracts one from the x/y values of the object. There are two versions, one for pre- and one for post-decrement. Pre-decrement returns a reference to the decremented Point and post-decrement returns a new Point with the value of the "before decrement point". Both are mmber functions

-

Unary Negation

Member function that returns a new Point with the x/y values of input Point negated.

+

Translation

Adds two Points or a Point and a double and returns a new Point. The Point/Point method is a member function. However, there are two versions of the double/Point function. One is a member function while the other is non­member non-friend function.

*

Scale

Multiplies a Point by some numeric factor of type double and returns a new Point. There will be two versions of this ± one is a member function while the other is a non-member non- friend function.

<<

Output

Outputs a Point in the form of a string: (x, y), where x and y are the coordinates, e.g. (4, 7). This is a friend function. Make sure you format it exactly as shown.

>> 

Input

Inputs a Point. Allows two numbers (separated by whitespace) to be entered, e.g. 4 7. This is a friend function. The inputs are both of type double.

The following syntax will be supported:

Point pt1(3, 4);   // pt1 is  (3, 4)
Point pt2;          // pt2 is   (0, 0)      
Point pt3(pt1);   // pt3 is   (3, 4) - uses the default copy constructor
Point pt4 = pt1; // pt4 is    (3, 4) - uses the default copy constructor  
Point pt5;         // pt5 is    (0, 0)
pt5 = pt4;        // pt5 is    (3, 4) - uses the default assignment operator

The following syntax is not allowed:
Point pt6 = 4; // this should not compile
Point pt7(4); // this should not compile

The starting point for the interface is in Point. h which is provided. You will need to modify this before implementing the functionality in Point . cpp. You will not need to use the new keyword in this assignment as wedo not require any dynamic memory allocation. If you are not sure of the functionality of an operator, look at the sample driver and output. All of the information you need can be discovered from the sample test program (driver-sample.cpp) that is provided.

What to Submit
You must upload your header file (Point.h), implementation file (Point.cpp), Doxygen-generated index.chm, and the signed programming assignment checklist in a .zip file to the assignment web page. Note that you are not submitting any other file. Hard copy submissions will not be accepted.

Description

Point.cpp - The implementation file. All function definitions go here. You must document the file with a file header comment. You do not have to use fully formatted function header comments for the overloaded operator functions, but you still must put a comment above the function saying what it's purpose is (e.g. adding a double and a Point). You also don't have to document the very trivial functions but you still must document code that is non-obvious. In other words, if you have more than a couple lines of code, you must document it.

Point.h - The header file. You will need to modify the one I posted. You must document the file with a file header comment. Absolutely NO implementation permitted in this file.

Usual stuff
Your code must compile (using the specified compilers) to receive credit. Make sure your name and other information is on all documents (paper and electronic).

Attachment:- Lab.zip

Reference no: EM132223475

Questions Cloud

Changed operations and supply change management : Why has this concept taken off so rapidly in the past 10 years? How has it changed Operations and Supply Change Management?
Identify risks and perform qualitative risk analysis : It is sufficient to do “Identify Risks” and “Perform Qualitative Risk Analysis” only once – during the beginning of the project. T
Candidates positions on health care issues : The purpose of this discussion is to discover elected officials or candidates’ positions on health care issues. Did you find any doublespeak or lack of clarity?
Beneficial for career advancement : Lifelong learning can also be beneficial for career advancement.
Demonstrate the usage of objects of point class by a client : CS 170 - High-level Programming - implement a Point class to represent points in a two-dimensional Cartesian coordinate system. To help you understand
Businesses operating in the information age : Do you agree that MIS is essential for businesses operating in the information age? Why or why not?
Career center can be useful when trying to find employment : The job search tools in the Career Center can be useful when trying to find new employment.
Do you agree with the timeframe : Expand on the 5th wave of technology innovation by giving some examples of information technology that we could say is helping shape this definition.
Professional attributes and life-long learning : Reflection, knowing one’s professional attributes and life-long learning are all key elements required for educators to be maximize their potential both inside

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd