Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
Question
Book Icon
Chapter 13, Problem 13.10PE
Program Plan Intro

Rectangle.java

Program Plan:

  • Include a class name named “Exercise_13_10”.
    • Declare the main() method.
    • Create three rectangle objects and assign values to them using the Rectangle class.
    • Display the area of each circle object referencing Rectangle class.
    • Display if Rectangle1 is equal to Rectangle 2 or not by referencing Rectangle class.
    • Close the main() method.
    • Close the class.
  • Include an abstract class “GeometricObject”.
    • Declare all the data types of the variables.
    • Construct a default geometric object.
    • Construct a geometric object with color and filled value.
    • Assign color and fill to the object.
    • Set a new color.
    • Define an isFilled method returns filled and since filled is Boolean; the get method is named isFilled.
    • Set a new filled and getDateCreated method.
    • Override toString function to return output.
    • Define Abstract method getArea.
    • Define Abstract method getPerimeter.
    • Close class.
  • Include a class “Rectangle” that extends the class GeometricObject and implements Comparable.
    • Declare width and height of rectangle.
    • Create a Rectangle constructor.
    • Assign values to height and width.
    • Assign rectangle values to all attributes.
    • Create a function to return width.
    • Create a function to return radius.
    • Create a function to set a new width.
    • Create a function to return height.
    • Create a function to set a new height.
    • Create an override function to return area.
    • Create an override function to return Perimeter.
    • Create an override function that returns true if objects area is the same.
    • Create an override function to implement compareTo method.
    • Close class.

Blurred answer
Students have asked these similar questions
(Java) Question 5 Explain the answer step-by-step and include verbal explanation. Thank you!    Write an interface as follows: The interface is named ServiceReminder It has one method named timeForService that has no parameters and returns a boolean variable. Now, update the below class so that is inherits from ServiceReminder Note that the next service date should be 90 days from the last service public abstract class Car {    private double gasGauge;    private double currMileage;    private String color;    private String make;    private String model;    private int daysLastService;    public Car(String color, String make, String model, int daysLastService) {        this.color = color;        this.make = make;        this.model = model;        gasGauge = 0.0;        currMileage = 0.0;        this.daysLastService = daysLastService;    }    @Override public String toString() {        return "Make: " + make            + "\nModel: " + model            + "\nColor: " + color…
(WRITE JAVA CODE AND SEND SCREENSHOTS) You need to develop a system in Java for a Juice company. Create a class Juice with data member’s sugar, flavour, size, amount of water, and price. Write required Constructors (no argument and parameterize) for this class. Write a member method showJuice() to display the contents of a juice object though you may have to write some more methods as per need.           In main() method you need to create different juices with the following specifications: 1)            Sugar = 5g, flavor = mango, size = ½ (half liter), water = ½ liters, price = $1 2)            Sugar = 2g, flavor = orange, size = ½ (half liter), water = ½ liters, price = $2 3)            Sugar = 3g, flavor = graps, size = ½ (half liter), water = ½ liters, price = $3 You also need to create 1 litter juices for the company by adding objects of two half litter juices. While adding two half litter flavours to make a 1 litter juice, make sure you can only add same flavour juices. If two…
(already solved on bartleby) You are required to build a mini FunTime application for the kids to playwith their electronic toys in a virtual world. Follow the given steps   Build a class Toy having the following data members   Name(String) Color (String) Type (String) Price (float) batteryHealth (int)   Provide constructor with arguments for name, color, type, and price. Initialize batteryHealth to 5 (which means full).   Provide getter for each of these but no setters. Provide a function charge(String time). This function would increase the batteryHealth of the toy according to following rules   Time   Increase in battery health   15 mins   20% charging (Increase health by 1)   30 mins   40%   45 mins   60%   1 hour   80%   1 hour 15 mins   100%   If the toy is already fully charged, then no more charging should be done and appropriate message to be displayed. The charge function returns the new health of the battery of toy object.   Provide another function play() that reduces the…

Chapter 13 Solutions

Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)

Ch. 13.4 - How do you create a Calendar object for the...Ch. 13.4 - For a Calendar object c, how do you get its year,...Ch. 13.5 - Prob. 13.5.1CPCh. 13.5 - Prob. 13.5.2CPCh. 13.5 - Prob. 13.5.3CPCh. 13.5 - Prob. 13.5.4CPCh. 13.6 - Prob. 13.6.1CPCh. 13.6 - Prob. 13.6.2CPCh. 13.6 - Can the following code be compiled? Why? Integer...Ch. 13.6 - Prob. 13.6.4CPCh. 13.6 - What is wrong in the following code? public class...Ch. 13.6 - Prob. 13.6.6CPCh. 13.6 - Listing 13.5 has an error. If you add list.add...Ch. 13.7 - Can a class invoke the super.clone() when...Ch. 13.7 - Prob. 13.7.2CPCh. 13.7 - Show the output of the following code:...Ch. 13.7 - Prob. 13.7.4CPCh. 13.7 - What is wrong in the following code? public class...Ch. 13.7 - Show the output of the following code: public...Ch. 13.8 - Prob. 13.8.1CPCh. 13.8 - Prob. 13.8.2CPCh. 13.8 - Prob. 13.8.3CPCh. 13.9 - Show the output of the following code: Rational r1...Ch. 13.9 - Prob. 13.9.2CPCh. 13.9 - Prob. 13.9.3CPCh. 13.9 - Simplify the code in lines 8285 in Listing 13.13...Ch. 13.9 - Prob. 13.9.5CPCh. 13.9 - The preceding question shows a bug in the toString...Ch. 13.10 - Describe class-design guidelines.Ch. 13 - (Triangle class) Design a new Triangle class that...Ch. 13 - (Shuffle ArrayList) Write the following method...Ch. 13 - (Sort ArrayList) Write the following method that...Ch. 13 - (Display calendars) Rewrite the PrintCalendar...Ch. 13 - (Enable GeometricObject comparable) Modify the...Ch. 13 - Prob. 13.6PECh. 13 - (The Colorable interface) Design an interface...Ch. 13 - (Revise the MyStack class) Rewrite the MyStack...Ch. 13 - Prob. 13.9PECh. 13 - Prob. 13.10PECh. 13 - (The Octagon class) Write a class named Octagon...Ch. 13 - Prob. 13.12PECh. 13 - Prob. 13.13PECh. 13 - (Demonstrate the benefits of encapsulation)...Ch. 13 - Prob. 13.15PECh. 13 - (Math: The Complex class) A complex number is a...Ch. 13 - (Use the Rational class) Write a program that...Ch. 13 - (Convert decimals to fractious) Write a program...Ch. 13 - (Algebra: solve quadratic equations) Rewrite...Ch. 13 - (Algebra: vertex form equations) The equation of a...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education