a)
“abstract” class:
An abstract class is a class which may or may not include abstract methods and cannot be instantiated but rather it can be sub classed.
Legal “abstract” class:
- The conditions for a class to be considered as legal abstract class are mentioned below:
- If a class includes abstract methods, then the class must be declared as abstract.
- The abstract method that is declared within the abstract class must be declared without braces and followed by a semicolon.
Example of a Legal “abstract” class:
The example of a legal abstract class is mentioned below:
public abstract class GraphicRectangle {
//declare fields
//declare methods
abstract void drawRectangle();
}
Given code:
//class definition
class A {
//declaration of an abstract method
abstract void unfinished() {
}
//end of class
}
b)
“abstract” class:
An abstract class is a class which may or may not include abstract methods and cannot be instantiated but rather can be sub classed.
Legal “abstract” class:
The conditions for a class to be considered as legal abstract class are mentioned below:
- If a class includes abstract methods, then the class must be declared as abstract.
- The abstract method that is declared within the abstract class must be declared without braces and followed by a semicolon.
Example of a Legal “abstract” class:
The example of a legal abstract class is mentioned below:
public abstract class GraphicRectangle {
//declare fields
//declare methods
abstract void drawRectangle();
}
Given code:
//class definition
public class abstract A {
//declaration of an abstract method
abstract void unfinished();
//end of class
}
c)
“abstract” class:
An abstract class is a class which may or may not include abstract methods and cannot be instantiated but rather can be sub classed.
Legal “abstract” class:
The conditions for a class to be considered as legal abstract class are mentioned below:
- If a class includes abstract methods, then the class must be declared as abstract.
- The abstract method that is declared within the abstract class must be declared without braces and followed by a semicolon.
Example of a Legal “abstract” class:
The example of a legal abstract class is mentioned below:
public abstract class GraphicRectangle {
//declare fields
//declare methods
abstract void drawRectangle();
}
Given code:
//class definition
class A {
//declaration of an abstract method
abstract void unfinished();
//end of class
}
d)
“abstract” class:
An abstract class is a class which may or may not include abstract methods and cannot be instantiated but rather can be sub classed.
Legal “abstract” class:
The conditions for a class to be considered as legal abstract class are mentioned below:
- If a class includes abstract methods, then the class must be declared as abstract.
- The abstract method that is declared within the abstract class must be declared without braces and followed by a semicolon.
Example of a Legal “abstract” class:
The example of a legal abstract class is mentioned below:
public abstract class GraphicRectangle {
//declare fields
//declare methods
abstract void drawRectangle();
}
Given code:
//class definition
abstract class A {
//declaration of a protected method
protected void unfinished();
//end of class
}
e)
“abstract” class:
An abstract class is a class which may or may not include abstract methods and cannot be instantiated but rather can be sub classed.
Legal “abstract” class:
The conditions for a class to be considered as legal abstract class are mentioned below:
- If a class includes abstract methods, then the class must be declared as abstract.
- The abstract method that is declared within the abstract class must be declared without braces and followed by a semicolon.
Example of a Legal “abstract” class:
The example of a legal abstract class is mentioned below:
public abstract class GraphicRectangle {
//declare fields
//declare methods
abstract void drawRectangle();
}
Given code:
//class definition
abstract class A {
//declaration of an abstract method
abstract void unfinished();
//end of class
}
f)
“abstract” class:
An abstract class is a class which may or may not include abstract methods and cannot be instantiated but rather can be sub classed.
Legal “abstract” class:
The conditions for a class to be considered as legal abstract class are mentioned below:
- If a class includes abstract methods, then the class must be declared as abstract.
- The abstract method that is declared within the abstract class must be declared without braces and followed by a semicolon.
Example of a Legal “abstract” class:
The example of a legal abstract class is mentioned below:
public abstract class GraphicRectangle {
//declare fields
//declare methods
abstract void drawRectangle();
}
Given code:
//class definition
abstract class A {
//declaration of an abstract method
abstract int unfinished();
//end of class
}
Trending nowThis is a popular solution!
Chapter 13 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
- Two base classes have functions with the same name, while a class derived from both base classes has no function with this name. How do objects of the derived class access the correct base class function? Write your own program to explain the answer.arrow_forwardIf a member is declared private in a class, can it be accessed from other classes? If a member is declared protected in a class, can it be accessed from other classes? If a member is declared public in a class, can it be accessed from other classes?arrow_forwardWhich statement of the following is the most appropriate? Group of answer choices When you design a class, always make an explicit statement of the rules that dictate how the member variables are used. These rules are called the invariant of the class, and should be written at the botttom of the implementation file for easy reference. When you design a class, always make an explicit statement of the rules that dictate how the member variables are used. These rules are called the variant of the class, and should be written at the botttom of the implementation file for easy reference. When you design a class, always make an explicit statement of the rules that dictate how the member variables are used. These rules are called the invariant of the class, and should be written at the top of the implementation file for easy reference. When you design a class, always make an explicit statement of the rules that dictate how the member variables are used. These rules are called the…arrow_forward
- Write a class declaration for a class named Circle, which has the data member radius, a double, and member functions setRadius and getArea. Write the code for these as inline functions.arrow_forwardCan a derived class directly access by name a private instance variable ofthe base class?arrow_forwardPeople in School Objective: At the end of the activity, the students should be able to: Create a program that exhibits inheritance. Procedure: Write a simple information system that will store and display the complete information of a student, faculty, or employee. Create four (4) no-modifier classes named Person, Student, Faculty, and Employee. Create a public class named CollegeList. This class shall contain the main method. Refer to the UML Class Diagram for the names of the variables and methods. The (-) symbol represents private variables, while (+) represents public method. This should be the sequence of the program upon execution: Prompt the user to select among Employee, Faculty, or Student, by pressing E, F, or S. Ask the user to type the name and contact For Employee, ask the user to type the employee's monthly salary and the department where he/she belongs to (Ex. Registrar). Then, display name, contact number, salary, and For Faculty, ask the user to press Y if…arrow_forward
- PROGRAMMING LANGUAGE: C++ Write a program that has a base class named FlightCrew. This class shouldhave three data members: an integer to store the ID of the crew member, aninteger to store the number of years of service and another integer to storethe total salary of the member. Provide a parameterized constructor in theclass to set the values of the data members.Derive a class Pilot from FlightCrew to contain two additional data members,an integer to store the number of hours of flight and a boolean to storewhether the Pilot has military experience or not. Provide a paramete rizedconstructor in the Pilot class. Provide a function bonus() in the class wherethe bonus of a pilot is his number of flight hours times the 10% of his salary.Likewise, provide a function isEligible() in the class to find out if the pilot iseligible for promotion or not. A pilot is eligible for promotion to the nextrank if he has at least 5 years of experience and the number of total flighthours is greater…arrow_forwardComplete the following table by filling in private, protected, public, or inaccessible in the right-hand column: In a private base class, this base class MEMBER access specification... ..becomes this access specification in the derived class. private protected publicarrow_forwardWhat is the main difference between a struct and a class? (More than 1 answer can be chosen)arrow_forward
- Create a class called Person. From this class, inherit another class called student. Assume suitable data members and member functions for these two classes. In both the classes, define the __str__ function and demonstrate method overriding. in python programmingarrow_forwardHow do you define a friend function to access a class’s private members?arrow_forwardwhat does the following mean? class A: public B Select one: a. class B will inherit all the non-private members from A without changining their access method. b. class A will inherit all the non-private members from B and make them public access. c. class B will inherit all the non-private members from A and make them public access. d. class A will inherit all the non-private members from B without changing their access method. c++arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,