java eclipse and send a screenshot of
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
please write comments in java eclipse and send a screenshot of the output.

Transcribed Image Text:**Part 1: Create a new package HW5 and create a Parent Class called “Fruit” strictly based on the UML.**
(Do not include anything extra, do not miss any data fields or methods. `#` denotes protected visibility modifier. *Underline* denotes static variable and static method.) Add the line “numberOfFruits++;" at the end of both constructors (as the last statement). *Add comments to your program* (comment for the data fields, constructors, getters, setters and toString() methods).
We will use `enum Color` to denote a fruit’s color. Add the code for `enum Color` on top of the class.
```java
enum Color {
YELLOW, ORANGE, RED, PURPLE;
}
```
---
### Diagram Explanation:
The diagram illustrates the structure of the `Fruit` class. Below is a detailed explanation of the UML diagram:
- **Attributes:**
- `- color: Color` : A private attribute to store the color of the fruit.
- `- calories: int` : A private attribute to store the number of calories.
- `- pricePerPound: double` : A private attribute to store the price per pound.
- `# numberOfFruits: int` : A protected static attribute to keep track of the number of fruits.
- **Constructors:**
- `+ Fruit()`: A public default constructor.
- `+ Fruit(color: Color, calories: int, pricePerPound: double)`: A public constructor that initializes a fruit with specific values for color, calories, and price per pound.
- **Methods:**
- `+ getColor(): Color`: A public method to return the color of the fruit.
- `+ setColor(color: Color): void`: A public method to set the color of the fruit.
- `+ getCalories(): int`: A public method to return the calories of the fruit.
- `+ setCalories(calories: int): void`: A public method to set the calories of the fruit.
- `+ getPricePerPound(): double`: A public method to return the price per pound of the fruit.
- `+ setPricePerPound(pricePerPound: double): void`: A public method to set the price per pound of the fruit.
- `+ getNumberOfFruits(): int`: A public static method to return
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY