Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8301803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:07:55+00:00 2026-06-08T17:07:55+00:00

I have an assignment which I’m finding very difficult. Any help would be appreciated.

  • 0

I have an assignment which I’m finding very difficult. Any help would be appreciated.

Build the hierarchy by creating the Shape classes Circle, Square, and Triangle. For these derived classes, create default constructors and constructors whose arguments can initialize the shapes appropriately using the correct number of Point objects (i.e., Circle requires a Point center and a radius; Square requires four Point vertices, while Triangle requires three Point vertices).

In main(), create one instance each of the following: a Circle with a radius of 23, a Square with sides 25, and a Triangle with sides 10, 20, 30. Define all of them so that the origin (0,0) is somewhere within each object. Display the information from each object.

When I enter under main() Square s(25, Point(0,0));

class Square : public Shape
{
  double sides;
  Point cp;

  public:
  Square() : sides(0) {}
  Square(double side, const Point &center) : sides(side), cp(center){}

  void bbox()
  {
     Point bottomright = cp + Point(sides/2, -sides/2);
     Point topleft = cp + Point(-sides/2, sides/2);
     Point topright = cp + Point(sides/2, sides/2);
     Point bottomleft = cp + Point(-sides/2, -sides/2);

     std::cout << "Square::bounding " << bottomright  << topleft << topright << bottomleft;
  }

  double area() {std::cout << "Square::area "; return (sides * sides);}
  double circumference() {std::cout << "Square::perimeter "; return sides + sides + sides + sides;}

};

The class prints out

Square::area 625
Square::perimeter 100
Square::bounding (12.5,-12.5)(-12.5,12.5)(12.5,12.5)(-12.5,-12.5)

I’m wondering does this look right based on what the assignment is asking?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:07:56+00:00Added an answer on June 8, 2026 at 5:07 pm

    No it doesn’t, from the requirement it appears you need the Square constructor to take 4 points as arguments:

    Square(const Point& pt1,const Point& pt2,const Point& pt3,const Point& pt4)
    

    Square requires four Point vertices

    Right?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a student in college and have an assignment which requires finding large
Aloha everyone, I have a class assignment in which I am tasked to build
I have this assignment based on coin and card games which is very simplified.
I have an assignment in which I have to allow a user to plot
I have a Scheme assignment in which a user is to input a list
Are there exceptions for types which can't have thier assignment operator overloaded? Specifically, I'm
I'm rushing against the clock for a programming assignment in which I have to
I have to do an assignment in JAVA in which I have to connect
I have my first professional assignment of making a website in which a photographer's
I have an assignment in which I need to create a function that tells

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.