Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Observe the code in the
class Fruit{
double sweetness;
abstract void print();
}
Program these entities (specify whether the interface or class):
Banana (has properties /methods from Fruit and it is not an abstract class, it has an additional property String color),
Mellon (has properties/methods from Fruit and it is not an abstract class, it has an additional property: weight)
and WaterMellon (has methods/properties from Mellon and additional method returnWeight(), that return the fruit weight).
Program a new class that in metod main() implements objects from presented classes where applicable.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- do this with javaarrow_forwardAbstract classes and interfaces may both be used to accomplish the goal of defining the behavior of common objects.Which factors should you take into account when deciding whether to utilize an interface or an abstract class?arrow_forwardAbstract classes and interfaces may both be used to accomplish the goal of defining the behavior of common objects.Which factors should you take into account when deciding whether to utilize an interface or an abstract class?arrow_forward
- Write a class named IceCreamCup that implements the Customizable interface. The class should have the following private instance variables. Do NOT give any method implementations for this question, but only declare the instance variables. Do NOT initialize the instance variables -- except nCups below. A String variable name describing the ice cream name • A List of Flavor s added to the cup. Name it flist Additionally, define the following static variable: • An int nCups describing the total number of ice cream cups instantiated. Initialize this variablearrow_forward1. An abstract class called Pet is defined below: public abstract class Pet{ private String id;private String name; private static int count = 0; public Pet(String name) { count++; id = "P" + count; this.name = name; } public String toString() { return "ID: " + id + ", Name: " + name; } abstract public void sound();} The Cat class is a subclass of the Pet class. The class specifications are given below:• It has a private field named age to record the cat’s age.• The class constructor sets both name and age fields of the cat with the given parameter values. The field age is set to 0 if the given value is negative. • It provides an accessor method for the field age. • It overwrites the toString method to return a string consisting of the cat’s ID, nameand age. e.g.ID: P15, Name: Molly, Age: 4• It prints out "Miaow" in a terminal when the method sound is called. Define the Cat class in full.arrow_forwarddefined the cat class in fullarrow_forward
- C# LANGUAGE polymorphism to iterate across different employees. SEE PICTURE FOR EXAMPLE OUTPUT Employee 1 is HourlyEmployeeEmployee 2 is PerDaymployeeEmployee 3 is MonthlyEmployeearrow_forwardIn order to qualify as a subclass of an abstract class, a class must offer concrete implementations for all of the abstract methods defined in the abstract parent class. Exactly how do you feel about this?arrow_forwardA subclass of an abstract class must provide concrete implementations for each of the parent class's abstract methods in order to be considered a subclass. What are your thoughts on this?arrow_forward
- JAVA: Briefly describe (1-2 sentences) each of the following object-oriented programming concepts: Attributes Methods Primitive Data Types vs. Objects Static methods/variables vs. non-staticarrow_forwardWrite the definition of classes and interfaces in the given diagram using following details: a) Interface shape has a method draw(). b) Override the method draw() in all subclasses. c) Define a non-abstract method fillColor() in Circle class. (I want the complete solution using the codes in bluej program also diagram) bluej java coodarrow_forwardState a circumstance in which you would prefer an interface over an abstract class. Also, State a circumstance in which you would prefer an abstract class over an interface.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education