Indicate true or false for the following statements:
a. A protected datum or method can be accessed by any class in the same package.
b. A protected datum or method can be accessed by any class in different packages.
c. A protected datum or method can be accessed by its subclasses in any package.
d. A final class can have instances.
e. A final class can be extended.
f. A final method can be overridden.
Want to see the full answer?
Check out a sample textbook solutionChapter 11 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Additional Engineering Textbook Solutions
Concepts Of Programming Languages
Starting Out With Visual Basic (7th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
C Programming Language
Java: An Introduction to Problem Solving and Programming (7th Edition)
- For each statement, indicate if it is True or False by circling T or F. If you need to cross out an answer, be sure that your final answer is clear and unambigous-otherwise it will receive no credit. 1- An object of a derived class has access to the public methods of its base class T F 2- An object of a base class has access to the private helper methods of its derived class T F 3- Destructors are not inherited by derived classes T F T F T F u- An object of a derived class inherits the copy constructor of its base class 5- Operators are passed down inheritance hierarchies 6- Destructors in derived classes are called after their base class calls its destructor 7. Constructors of base classes are accessible by derived classes T T F Farrow_forwardsubject: object-oriented programming in your library there are two types of books. one category is literature books and the second category is generals. litrature books have the authorID, authorname literature theme language, publisher, volumn,, yearofpubication, journal have attributes volumn, issue, publisher,yearofpublication,journalID, technical sponser. design a parent class books extend two classes literaturebooks and journel from parent class make constructor , setter, and getterarrow_forwardAnswer with True or False for the following. Explain your answers.-It is legal to write a method in a class which overloads another method declared in the same.-It is legal to write a method in a superclass which overrides a method declared in a sub-class.arrow_forward
- Write In c++arrow_forwardDefine a java Name class with attributes: String firstname, middle name, lastname. Include the following methods: - A constructor with 3 parameters. Initialize the 3 member variables to the parameters being passed. Also, include the default constructor. - getter and setter methods for all attributes - override toString method Define a class called DebitCard. A debit card has a card number, Name and balance. a) Include a constructor with 3 parameters. Initialize the 3 member variables to the parameters being passed. Also, include the default constructor. b) Include getters/setters for all attributes. c) Add the following member functions: float inquireBalance() float depositCash(float amount) //increases the balance with amount boolean withdrawCash(float amount) // returns true if sufficient amount is available for withdrawal and decreases the balance by amount float interest(float rate) //calculates the interest rate incurred. Assume the parameter rate is considered as…arrow_forwardDefine a java Name class with attributes: String firstname, middle name, lastname. Include the following methods: - A constructor with 3 parameters. Initialize the 3 member variables to the parameters being passed. Also, include the default constructor. - getter and setter methods for all attributes - override toString method Define a class called DebitCard. A debit card has a card number, Name and balance. a) Include a constructor with 3 parameters. Initialize the 3 member variables to the parameters being passed. Also, include the default constructor. b) Include getters/setters for all attributes. c) Add the following member functions: float inquireBalance() float depositCash(float amount) //increases the balance with amount boolean withdrawCash(float amount) // returns true if sufficient amount is available for withdrawal and decreases the balance by amount float interest(float rate) //calculates the interest rate incurred. Assume the parameter rate is considered as…arrow_forward
- Create a C++ class and name it Vehicle. The class Vehicle has two constant private members: license and year. Write a constructor with two arguments. Make the Vehicle class an abstract class. Create another C++ class and call it Car. The Car class inherits form Vehicle class and has another private member (brand). Write a constructor with three arguments. Write a method that returns the following: My car is BMW (2020) with a license of ABC123. Write a C++ program. Create an instance of the Car class and display its members value and call its method. You are not allowed to use materials that are not covered in our lectures.arrow_forward10. Java automatically applies the method to an object referenced in a String expression to represent an object’s state. a. toString () b. abstract c. super() d. this() 11. The call in a class constructor invokes the superclass's constructor that has the corresponding argument list. a. tostring () b. abstract c. super() d. this() 12. The call to invokes the constructor for the current class whose parameter list matches the argument list. a. toString () b. abstract c. super() d. this() 13. If no constructors are defined for a class, the constructor for that class will be provided by default. a. private b. super c. public d. no-argument 14. What is a keyword to declare a subclass to a super class in Java? a. implements b. extends c. throws d. followsarrow_forwardObject Oriented Programming: 213COMP, 214COMP (Feb-2022) Assignment- I [10 marks] Academic honesty: O Only pdf file accepted & student ID, will be your upload file. O Student who submit copied work will obtain a mark of zero. O Late work or attach file by email message not allowed. Q1: Write the signature for a method that has one parameter of type String, and does not return a value. Q2: Write the signature for a method that has two parameters, both of type Student, and returns an int value. Q3: Write the constructor's headers of the followings? new Student (202101156, “Ahmed"); new Address(51, "jazan university","CS&IT" ); new Grade(true, 505235600, 4.5); Q4: a) Write a class Student that define the following information: name, stid , age. b) Explain a mutators (setters) and accessors(getters) methods for each attributes(fields). c) Add three constructors: • with empty constructor. one parameter constructor (name of student) two parameters constructor (name and stid) d) Create two…arrow_forward
- Java- Suppose that Vehicle is a class and Car is a new class that extends Vehicle. Write a description of which kind of assignments are permitted between Car and Vehicle variables.arrow_forwardUsing c++ Design a Wacky class that can be used to generate a message based on the information passed to it. The class should have a single integer private member variable: int num; Design the complete class so that if: an object is created with no parameters; num is initialized to 10. an object is created with 1 parameter that is an integer; num is initialized to the integer that is passed *2 an object is created with 1 parameter that is a double; num is initialized to the double *4 an object is created with 2 parameters, a char and a string; it prints the message "That's WACKY!"arrow_forward1. Create a properly encapsulated class named Person that has the following: A String instance variable called name. A constructor that takes a String parameter and sets the instance variable. A properly named getter for the instance variable. A correctly overrided equals method which returns true if the name instance variable of the parameter and the reference variable calling the method are equal. (Do not forget the null and class type checks!) Compile your Person class. 2. Create a properly encapsulated class named Employee that inherits from Person and has the following: ● ● ● A String instance variable called office (e.g. "LWH 2222"). A String instance variable called hourlywage (e.g. "$45.15"). A constructor that takes three Strings as parameters for name, office, and hourlyWage and sets the instance variables of both the parent class and the Employee class. An overridden toString method that returns the concatenation of name and hourlyWage instance variables (separated by a…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,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning