Python only please, thanks in advance.
GeometricObjectClass.py
class GeometricObject:
def __init__(self, color="green", filled = True):
self.color = color
self.filled = filled
def getColor(self):
return self.color
def setColor(self, color):
self.color = color
def isFilled(self):
return self.filled
def setFilled(self, filled):
self.filled = filled
def _str__(self):
return "color" + self.color +" and filled:" + str(self.filled)
RectangleClass.py from GeometricObjectClass import GeometricObject class Rectangle(GeometricObject): def __init__(self, length, width): super().__init__() self.length = length self.width = width def getLength(self): return self.length def setLength(self, length): self.length = length def getWidth(self): return self.width def setWidth(self, width): self.width = width def getArea(self): return self.length * self.width def getPerimeter(self): return 2 * (self.length + self.width) def __str__(self): return "rectangle with length:"+ str(self.length) +" and width:"+ str(self.width) TestRectangle.py
from RectangleClass import Rectangle # method to check if number is digit using try/except def is_value_digit(n): try: int(n) return True except ValueError: return False # method to get non negative number def getNonNegativeIntegerInput(question): n = input(question) if is_value_digit(n) is True: if int(n)>0 : return int(n) else: print(n, "is negative enter positive value.") return getNonNegativeIntegerInput(question) else: print(n, "is not an integer.") return getNonNegativeIntegerInput(question) def main(): filled = eval(input("Type 1 for filled and 0 for not filled:")) color = input("Type the rectangle color:") width = getNonNegativeIntegerInput("Enter the width:") length = getNonNegativeIntegerInput("Enter the length:") rectangle = Rectangle(width, length) if filled == 1: rectangle.setFilled(True) else: rectangle.setFilled(False) rectangle.setColor(color) print(rectangle) print() print("Area of rectangle:" + str(rectangle.getArea())) print("Perimeter of rectangle:" + str(rectangle.getPerimeter())) main() SAMPLE output screenshot:
Type up the GeometricObject class (code given on the back of the paper). Name this file Geometric...
Python only please, thanks in advance. Type up the GeometricObject class (code given on the back of the paper). Name this file GeometricObjectClass and store it in the folder you made (xxlab14) 1. Design a class named Rectangle as a subclass of the GeometricObject class. Name the file RectangleClass and place it in the folder. 2. The Rectangle class contains Two float data fields named length and width A constructor that creates a rectangle with the specified fields with default...
(The Triangle class) Design a class named Triangle that extends the GeometricObject class. The Triangle class contains: - Three float data fields named side1, side2, and side3 to denote the three sides of the triangle. - A constructor that creates a triangle with the specified side1, side2, and side3 with default values 1.0. - The accessor methods for all three data fields. - A method named getArea() that returns the area of this triangle. - A method named getPerimeter() that...
Write a class named Octagon (Octagon.java) that extends the following abstract GeometricObject class and implements the Comparable and Cloneable interfaces. //GeometricObject.java: The abstract GeometricObject class public abstract class GeometricObject { private String color = "white"; private boolean filled; private java.util.Date dateCreated; /** Construct a default geometric object */ protected GeometricObject() { dateCreated = new java.util.Date(); } /** Construct a geometric object with color and filled value */ protected GeometricObject(String color, boolean filled) { dateCreated = new java.util.Date(); this.color = color;...
Design a class named Triangle that extends GeometricObject class. The class contains: Three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. A no-arg constructor that creates a default triangle with color = "blue", filled = true. A constructor that creates a triangle with the specified side1, side2, side3 and color = "blue", filled = true. The accessor functions for all three data fields, named getSide1(), getSide2(), getSide3(). A function...
Please include comments in the program .The program must be able to be compiled.Design a class named Triangle that extends GeometricObject. This class contains:* Three double data fields named side1, side2, and side3 with default values 1.0 to denote the three sides of a triangle.* A no-arg constructor that creates a default triangle.* A constructor that creates a triangle with the specified side1, side2, and side3.* The accessor methods for all three data fields.* A method named getArea() that returns...
this is for java programming Please Use Comments I am not 100% sure if my code needs work, this code is for the geometric if you feel like you need to edit it please do :) Problem Description: Modify the GeometricObject class to implement the Comparable interface and define a static max method in the GeometricObject class for finding the larger (in area) of two GeometricObject objects. Draw the UML and implement the new GeometricObject class and its two subclasses...
The software I use is Eclipse, please show how to write it, thanks. GeometricObject class public abstract class GeometricObject { private String color = "white"; private boolean filled; private java.util.Date dateCreated; protected GeometricObject() { dateCreated = new java.util.Date(); } protected GeometricObject(String color, boolean filled) { dateCreated = new java.util.Date(); this.color = color; this.filled = filled; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public boolean isFilled() { return filled; } public...
write a completed program (included the main) for the Q: add an equals method to each of the Rectangle circle and triangle classes introduced in this chapter. two shapes are considered equal if their fields have equivalent values. based on public class Circle implements Shape f private double radius; // Constructs a new circle with the given radius. public Circle (double radius) f this.radius - radius; // Returns the area of this circle. public double getArea) return Math.PI *radius *...
Receiveing this error message when running the Experts code below please fix ----jGRASP exec: javac -g GeometricObject.java GeometricObject.java:92: error: class, interface, or enum expected import java.util.Comparator; ^ 1 error ----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete. 20.21 Please code using Java IDE. Please DO NOT use Toolkit. You can use a class for GeometricObject. MY IDE does not have access to import ToolKit.Circle;import. ToolKit.GeometricObject;.import ToolKit.Rectangle. Can you code this without using the ToolKit? Please show an...
Written in python using puTTy!! i'm having a lot of trouble with this, will upvote! also here is the address.csv file Name,Phone,Email,Year_of_Birth Elizi Moe,5208534566,[email protected],1978 Ma Ta,4345667345,[email protected],1988 Diana Cheng,5203456789,[email protected],1970 ACTIVITY I Implement in Python the Subscriber class modeled by the UML diagram provided below. Save in a file called MyClasses.py Subscriber name: string yearOfBirth: int phone: string email: string getName() getAge() getPhone() getEmail() Write a test program that does the following: Read the file addresses.csv. For each record, create an object...