Create a Shape class that shall have color and filled instance variables of enum Color and boolean type. The filled boolean variable shall show, whether the shape is filled (colored). The enum Color shall be defined within the class having 4 color names (choose any four).    Also define getArea and getPerimeter method in Shape class, both shall return 0. Create Rectangle class with length and width attributes and a Circle class with radius attribute, of type double. Properly encapsulate all fields.    Circle and Rectangle shall extend Shape class and override getArea and getPerimters methods as per its type and specific formula. In Test class, create an object of Rectangle and Circle, by initializing all attributes in constructor and print both shapes' area and perimters.   In Test class, define a static method with following signature,  public static void printEachShapeCount(Shape... shapes) As you know, the parent type variable can hold the reference of any child class object. That means, we can call above method by passing any number of Circle and Rectangle objects. Define the method body, such that, it shall print how many circles and how many rectangles were passed to this method in variable length argument.

Question
Create a Shape class that shall have color and filled instance variables of enum Color and boolean type. The filled boolean variable shall show, whether the shape is filled (colored). The enum Color shall be defined within the class having 4 color names (choose any four). 
 
Also define getArea and getPerimeter method in Shape class, both shall return 0. Create Rectangle class with length and width attributes and a Circle class with radius attribute, of type double. Properly encapsulate all fields. 
 
Circle and Rectangle shall extend Shape class and override getArea and getPerimters methods as per its type and specific formula. In Test class, create an object of Rectangle and Circle, by initializing all attributes in constructor and print both shapes' area and perimters.
 
In Test class, define a static method with following signature, 
public static void printEachShapeCount(Shape... shapes)
As you know, the parent type variable can hold the reference of any child class object. That means, we can call above method by passing any number of Circle and Rectangle objects. Define the method body, such that, it shall print how many circles and how many rectangles were passed to this method in variable length argument.
(Java)

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Engineering

Programing

Related Computer Engineering Q&A

Find answers to questions asked by students like you.

Q: Insert the following customer into the CUST_MYSQL table, allowing the AUTO_INCREMENT attribute set u...

A: insert into CUSTOMER(CUST_LNAME, CUST_FNAME, CUST_BALANCE)values('Powers', 'Ruth', 500);

Q: Please only do numer 1

A: The C++ program is written where array is used to perform the sum and average of the given zig zag e...

Q: There are n customer of bank who took loan of different amounts (Entered by User) and for different ...

A: FORMULA: The Compound Interest is calculated using formula CI = Principal(1+(rate/100))term -Princip...

Q: Make an empty array of 5-by-5 elements, enter the elements into array from keyboard,and print upper ...

A: #include<stdio.h> int main(){    int a[5][5],i,j;    printf("enter elements into 5 * 5 matrix"...

Q: how to convert text file having mix data type into 2D array in java

A: Note: Number of Rows and Column are according to user's requirement. You can change it. int row_i_wa...

Q: Machine cycle defines a loop process with four major components. Explain why machine cycle is import...

A: Importance of machine cycle Machine Cycle is important for the execution of machines instructed by ...

Q: please help me

A: a) i) If computer A sends a frame to computer B and if the switch 1 does not have the MAC address of...

Q: Who is the database administrator? Mention and describe their tasks.

A: Database Administrator is the one who has the access for database and performs various operations on...

Q: Write a program in c++ to do the following operations on a Binary Search Tree (BST) considering the ...

A: As specified in the question, The BST tree takes a string as input. Structure of Binary Search Tree...

Q: Scope Creep is of considerable concern on many IT projects as it has the potential to lead to less t...

A: SCOPE CREEP a) Scope Creep is also known as requirement creep or even feature creep. Scope creep def...

Q: What is inheritance? State the different types of inheritance supported by java with example

A: Inheritance is a mechanism where one object acquires all behaviors and properties of a parent object...

Q: RAID is a method to create live backups of physical hard disks but creating RAID will decreases the ...

A: For backups with applications like Int ego, Personal Back-up, or Time Machine Apple can be used with...

Q: I want to write c++ program of this ??

A: The C++ program and necessary comments are provided in the program Input text file: Sample output o...

Q: Please explain the three components of a security auditing system. Also, please provide example tool...

A: A security audit is the high level description of the many ways organization can test and access the...

Q: can you solve this in C language please

A: Program Plan:- Initialize all the necessary header files Declare the array with type double and siz...

Q: Create a two-dimensional array to contain the three sale items for five different artists. Asingle a...

A: Since the Programming language is not mentioned in the question, we will answer this question in C++...

Q: 2. JAVA Programming  Arrays a1, a2… are populated as shown; display a[i] for each calls to arr; if a...

A: Declare and initialize the five arrays given in the question, as static.   Inside the arr() method w...

Q: Write a method which takes as input a singly linked list and print the first duplicatenumber. Please...

A: import java.util.*;public class Duplicate{static class Node{int data;Node next;};static Node head_re...

Q: Which of the following factors does NOT cause the address (virtual or physical) of a specific variab...

A: The correct answer to- option A  The page cache does not cause an address change to occur.     Expla...

Q: Q.3.3 You are given the "resource requirements plan" diagram for a system, website, or network desig...

A: Q.3.3.1 On first day there is a need of designers from activity 1,2 and 3 Activity 1 needs 2 designe...

Q: Why would a network administrator want to filter certain ports when capturing data such as FTP traff...

A: FTP relies on a connection-oriented protocol that is TCP for transferring files.. To track total tra...

Q: Question 2.2 Write a function createPassword()with no return value to randomly select 8 capital lett...

A: NOTE: - Since the programming language is mentioned, the below problem is implemented in C language....

Q: Use c++ program

A: #include <iostream>using namespace std; class cms{    public:        string name;    int exper...

Q: Given a code segment of queue implementation                  if(front == rear)          front = rea...

A: The given problem is related to data structure queue. A queue is a Linear data structure where the d...

Q: Write a c++ program that will ask the user to input 10 integer number. count the number of even numb...

A: For the above problem, please find the solution code in the step 2 - As mentioned in the problem its...

Q: What is SQL and what is its use?

A: Please find the answer below :

Q: Which of the following factors does NOT cause the address (virtual or physical) of a specific variab...

A: Option B(Writing a '3' to /proc/sys/vm/drop_caches) is used to free os cache which can change addres...

Q: The following are excel sheets with column headings. Select all the themes that can be gleamed from ...

A: Objective: Two spreadsheet names along with column headings are given. These spreadsheets are EQUIPM...

Q: Drewa flowchart for a program for Huntersville College. The current tuition is $20,000 per year, and...

A: Actually, program is a executable software that runs on a computer.

Q: Im using python and i need to 1)Fill the function definitions 2) Fill in the missing code in main() ...

A: Solution is in Step 2.

Q: Write a function str_replace that takes three strings, str1, str2 and str3; and replaces the first o...

A: Please find the answer below :

Q: Alice and Bob use the following challenge –response authentication scheme based   on digital signatu...

A: Bob send challenge to Alice. Bob -> verifier Alice -> claimant Here, we have two categories of...

Q: The Huntington High School basketball team has five players named Art, Bob, Cal, Dan, and Eli. Accep...

A: Programming instructions:   Include the necessary header file. Create a class. In the main, create ...

Q: 1. Why do computers need to know the MAC address of the destination via the ARP packet?2. Can comput...

A: ARP stands for Address Resolution Protocol. When you try to ping an IP address on your local network...

Q: Who owns electronic mail systems, and why they do?

A: Electronic mail, since around 1993 is a method of exchanging digital messages from an author to one ...