ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 9 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 23 Apr 2017 My Price 11.00

Modify the Shapes.cpp file

I need help with this assignment. Thank you.

 

  1. Modify the Shapes.cpp file attached by writing code for each member function given for each class and your main function.. Do not modify the declaration section given for each class at all.
  2. The Rectangle.class is the base class and contains two protected data members to store a sideA and sideB.
  3. The Rectangle class constructor will accept two arguments which will contain a value for each side of the rectangle (sideA and sideB).  Assign a value to sideA and sideB using the value of the two parameters.
  4. Code getSideA and getSideB member functions to return back the value of the associated data member.
  5. Code the setSideA and setSideB member functions to assign the value passed to the function to the associated data member. Make sure within the member function that the value assigned is not zero or less. If the value passed to the parameter is zero or less assign the side to a default value of 1.
  6. Code the computePerimeter member function to compute and return back the perimeter of a Rectangle. This formula is given in the hyperlink for step 1.
  7. Code the computeArea memberr function to compute and return back the area of a Rectangle. This formula is given in the hyperlink for step 1.
  8. Overload the increment operator to increment (add to) the value stored in sideA and sideB by one.
  9. Overload the decrement operator to decrement (subtract from) the value stored in sideA and sideB by one.
  10. Overload the equality operator (==) to test two Rectangle objects for equality. This function should return back true if the two Rectangle objects are equal and false if the two Rectangle objects are not equal. The two Rectangle objects are equal if both the value of the sideA data members are equal and the value of the sideB data members are equal.
  11. Code the Square class to inherit from the Rectangle class. The inheritance will be public. No additional data members should be added to the Square class because it will inherit the data members from the Rectangle class. Other than what is already contained in the Shapes.cpp file (see step1), no additional member functions should be added to the Square class because it will inherit or override the member functions from the Rectangle class.
  12. The setSideA member function will override this same function from the parent class. Within this function assign the value of the data members sideA and sideB to the argument of this function. This means both data members will be assigned the same value because sideA and sideB of a square are equal.  Make sure within the member function that the value assigned is not zero or less. If the value passed to the parameter (the argument) is zero or less assign both sides to a default value of 1.
  13. The setSideB member function will override this same function from the parent class. Within this function assign the value of the data members sideA and sideB to the argument of this function. This means both data members will be assigned the same value because sideA and sideB of a square are equal. Make sure within the member function that the value assigned is not zero or less. If the value passed to the parameter (the argument) is zero or less assign both sides to a default value of 1.
  14. The Square class constructor will accept one argument which will contain a value for each side of the square (sideB will be assigned the same value as sideA). Use a base/member initialization list to call the Rectangle constructor to assign values for sideA and sideB of the Square. Keep in mind that sideA and sideB of a square are equal.
  15. The main function will be used to test your class hierarchy. 
  16. Test the Square class first. Prompt the user to enter in the side length of a square. Instantiate a Square object using the data entered in by the user. Call the displayData function passing it the Square object to display the values for this square.
  17. Use the overloaded increment operator with the Square object from the above step. You have to use the prefix increment operator in order for your program to compile and run. Call the displayData function passing it the Square object to display the new values for this square.
  18. Test the Rectangle class second. Prompt the user to enter in the first side length of a rectangle (sideA). Prompt the user to enter in the second side length of a rectangle (sideB). Instantiate a Rectangle object using the data entered in by the user. Call the displayData function passing it the Rectangle object to display the values for this rectangle.
  19. Use the overloaded decrement operator with the Rectangle object from the above step.  You have to use the prefix decrement operator in order for your program to compile and run. Call the displayData function passing it the Rectangle object to display the new values for this rectangle.
  20. Use the overloaded == operator to display a message indicating whether the Rectangle object and the Square object from the above steps are the same or different. 
  21. Make sure the output matches the image output.png.output.PNG

Attachments:

Answers

(11)
Status NEW Posted 23 Apr 2017 03:04 PM My Price 11.00

-----------

Attachments

file 1492963013-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)