Design program: shapes with area, perimeter using access control, method overloading, error checks, documentation.

In this problem, you will learn and practice OO programming concepts with

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

1) Python and 2) Java or C++.

We would like to process some standard geometric shapes. Each figure will be one of three standard shapes (rectangle, circle, and right triangle). We would like to be able to do standard computations, such as finding the area and perimeter, for any of these shapes.

A shape has a name. In addition, each rectangle has two other properties–width and height; each circle has one more property–radius, and each right triangle has two other properties– base and height. Choose appropriate data types for the information.

Program design requirements=====================The assignment will be graded based on the following requirements:a. When appropriate, demonstrate appropriate use of access controls for the class and its members.b. When appropriate, demonstrate method overloading and/or method overridden.c. When appropriate, override/redefine inherited methods, instead of creating new ones. d. Make sure input values are checked, for example, radius should not be negative or zero. e. Demonstrate the use of abstract methods.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

f. Be sure to professionally document your source code.

Homework 4: OO Programming with Python
Points: 40
Problem Description
================
In this problem, you will learn and practice OO programming concepts with
1) Python and 2) Java or C++.
We would like to process some standard geometric shapes. Each figure will be one of three
standard shapes (rectangle, circle, and right triangle). We would like to be able to do
standard computations, such as finding the area and perimeter, for any of these shapes.
A shape has a name. In addition, each rectangle has two other properties–width and height;
each circle has one more property–radius, and each right triangle has two other properties-base and height. Choose appropriate data types for the information.
Platform
========
You may use the Python environment from Pluto, download the Python environment to your
own computer, or online Python environment or Jupyter Notebook or Colab, etc.
Program design requirements
=====================
The assignment will be graded based on the following requirements:
a. When appropriate, demonstrate appropriate use of access controls for the class and its
members.
b. When appropriate, demonstrate method overloading and/or method overridden.
c. When appropriate, override/redefine inherited methods, instead of creating new ones.
d. Make sure input values are checked, for example, radius should not be negative or zero.
e. Demonstrate the use of abstract methods.
f. Be sure to professionally document your source code.
Submission
=========
Submit the following files in soft copy on or prior to the due date:
a. Source code for both programs
b. Source code for testing both programs (Testing code can be combined with that from
Part a)
c. Screenshots of two sample runs, one for each language. Make sure you test all the cases,
illustrated in the Python code below.
Sample testing code in Python as an example:
if __name__ == “__main__”:
# s = Shape() not allowed.
print(“\n******Testing Rectangle class******”)
rectangle = Rectangle(“Basketball Court”, 94, 50)
print(rectangle)
print(“\nChange the width to 100”)
rectangle.width = 100
print(rectangle)
print
print(“\nChange the height to -50”)
rectangle.height = -50
print(rectangle)
print
print(“\n******Testing Circle class******”)
circle = Circle(“The Olympic Ring”, 10)
print(circle)
print(“\nChange the radius to -100”)
circle.radius = -100
print(circle)
anothercircle = Circle(“Another ring”, 20)
print(“\nComparing circles”)
print(circle == anothercircle)
print(“\n******Testing Right Triangle class******”)
rt_triangle = RtTriangle(“A Red Flag”, 10, 10)
print(rt_triangle)
output:
******Testing Rectangle class******
Shape Name: Basketball Court
Area: 4700
Perimeter: 288
Width: 94
Height: 50
Change the widht to 100
Shape Name: Basketball Court
Area: 5000
Perimeter: 300
Width: 100
Height: 50
Change the height to -50
Invalid height value!
Shape Name: Basketball Court
Area: 5000
Perimeter: 300
Width: 100
Height: 50
******Testing Circle class******
Shape Name: The Olympic Ring
Area: 314.15000000000003
Perimeter: 62.830000000000005
Radius: 10
Change the radius to -100
Invalid radius value!
Shape Name: The Olympic Ring
Area: 314.15000000000003
Perimeter: 62.830000000000005
Radius: 10
Comparing circles
False
******Testing Right Triangle class******
Shape Name: A Red Flag
Area: 50.0
Perimeter: 34.14213562373095
Base: 10
Height: 10

Still stressed with your coursework?
Get quality coursework help from an expert!