QUESTION 2 A protected member of a class may be directly accessed by O methods of the same class methods of a subclass methods in the same package Any of these QUESTION 3 A subclass can directly access only public and private members of the superclass all members of the superclass O only protected and private members of the superclass O only public and protected members of the superclass
Q: Design a console program that will print details of prescribed textbooks of students. Make use of an…
A: Book.java public abstract class Book { public String author,title,category,price; //constructor…
Q: Identical-sounding variables that have been declared in a superclass and variables that have been…
A: Yes, they are treated as different variables.
Q: 4. Supposed you would like to override a method with a default modifier in the superclass, which…
A: Rule for Access Modifier of overridden method : Access Modifier of the overriding method (method of…
Q: A new class of objects can be created conveniently by —----------the new class (called the subclass)…
A: Inheritance
Q: Fill in the blank space 1. The ____________ keyword is used to create a new instance or object of…
A: Complete the following sentences with a proper answer, 1. The ____________ keyword is used to create…
Q: 9. Which of the following is FALSE about a subclass? A. A subclass has overridden methods from the…
A: Q19. subclass: the derived class (a class which is derived from another class) is known as the…
Q: Activity Inheritance and Polymorphism I. PROBLEM SOLVING Perform what is being asked. Write your…
A: ANSWER:-
Q: Java programming Help us set up the student system! 2.a) Write an abstract class Student…
A: PROGRAM EXPLANATION: Create an abstract class Student. Declare two data members' one is the name…
Q: If all the classes used parameterized constructors and no default constructor then _________ i The…
A: Correct option: ii
Q: subclass must implement all of the abstract methods of its parent
A: A class that is declared using the “abstract” keyword is called abstract class. It can have the…
Q: If a class B is derived from A, identify which of the following terms can be used to describe A:
A: the answer is an ALL OF THE OPTIONS as given below : Ancestor class Base class Parent class…
Q: When a subclass method has the same name, parameter list and return type as a method in the parent…
A: according to our guidelines we can answer only one question if you want answer of another question…
Q: Use the Diagram as your reference. You have the MainClass and two more classes ClassA and ClassB…
A: Inheritance is the property of the object-oriented programming language. Java supports…
Q: To write a program to invite members of superclass in subclass and create constructor to initialize…
A: Accessing superclass members into subclass is a concept of inheritance in which one class can use…
Q: Activity Inheritance and Polymorphism I. PROBLEM SOLVING Perform what is being asked. Write your…
A: Polymorphism: Poly means many and morphism means forms. Thus it can be represented in many forms.…
Q: True or false?(a) You can override a nonprivate method defined in a superclass.(b) You can override…
A: a) All non-private methods are inherited by the sub-class from its super-class. A non-private…
Q: Design a console program that will print details of prescribed textbooks of students. Make use of an…
A: public interface iPrintable { String DisplayDetails(); }
Q: Read a UML diagram to determine the new methods and or instance variables. Define instance…
A: Class Vehicle is declared as: String owner and int wheels as data members. A constructor…
Q: Programming Launguage = Python 2. ShiftSupervisor Class In a particular factory, a shift…
A: class Shiftsupervisor:#Initialize the Shiftsupervisor attributes def __init__(self, salary,…
Q: A superclass has the following abstract method: 1 þublic abstract int getValue(); 2 Identify an…
A: A superclass has the following abstract method
Q: Given: class SuperClass { SuperClass(int x) { System.out.println("Super"); } } public class SubClass…
A: Here, we are going to find out the suitable line n1 from given options. Code is in Java language and…
Q: A derived class has access to all of the methods of the parent class, but not to any of the instance…
A: the answer for the given question is:-
Q: Please write the following program in JAVA! Thanks, refer to photos.
A: Program: //Filename: “XXXX_TestWorker.java” import java.util.*; public class XXXX_TestWorker {…
Q: 13. A member of a class that is not associated with an instance of a class is known as A. final B.…
A: Required:
Q: An cannot be instantiated, they act as place holders for abstraction. a. Abstract class O b.…
A: A correct option is an option a i.e Abstract class
Q: CPSC 131: Introduction to Computer Programming II Program 3: Inheritance and Interface 1 Description…
A: Input Program :- import java.util.*; import java.io.*; public class PersonTester extends Person {…
Q: a. Describe the process of overriding a method from a superclass. b. Describe the isinstance…
A: a. Describe the process of overriding a method from a superclass. b. Describe the isinstance method.…
Q: In Python: A subclass can have a method with the same name as a method in the superclass True…
A: I have given answer in step2
Q: the Diagram as your reference. You have the MainClass and two more classes ClassA ar bectively.…
A: Program Approach: 1- Created three classes, as mentioned in the assignment classA, classB, and…
Q: CPSC 131: Introduction to Computer Programming II Program 3: Inheritance and Interface 1 Description…
A: two classes, Student and Instructor, that inherit from asuperclass Person. The implementation of…
Q: A customer has his money deposited $1000 ,$1500 and $2000 in the banks -bank A,bank B and bank C…
A: public class bank //declaring class{ //declaring method public int getbalance() {…
Q: Activity-1 Write a Program in Python to Implement Polymorphism with Function and Objects. V Create…
A: As per the requirement program is completed. Algorithm: Step 1: Create the Ferrari() and BMW()…
Q: variables are variables that have the same name as variables that have been declared in a superclass…
A: Variable : Variables are used to store information to be referenced and manipulated in a computer…
Q: variable of a superclass object? Upcasting Downcasting Extensive casting Both b and c above
A: Upcasting
Q: An abstract class can only be instantiated if at least half of its methods are defined
A: The answer for the given statement is as follows:-
Q: Fill in the blanks:…
A: Object oriented programming : Object oriented programming also abbreviated as OOPS as a programming…
Q: Assume you have a method expecting the superclass's object to be passed as an argument. In this…
A: In Java, all non-static methods are based on the runtime type of the underlying object rather than…
Q: Q2. Name the superclass. Q3. Name the subclass. Q4. Write at least TWO constructor(s) for the…
A: The solution for the above given question is given below:
Q: Question Write a class named Student with data attributes for a student's name, identification…
A: Note: Answering the question in python as no language is specified. Task : Define Student class…
Q: When we extend a class, the subclass's constructor only needs to call the super() constructor if we…
A: Solution: Given, Correct answer is : True Explanation:
Q: Explicit casting must be used when an object O is converted from sub class to super super class O is…
A: Explicit casting is a casting a sub type class to a super type class in upward direction to the…
Q: Inheritance and Polymorphism I. PROBLEM SOLVING Perform what is being asked. Write your code on a…
A: C # programming language is used to create the User and Administrator classes. The class User and…
Q: - is a modifier that used for superclass so that any of its subclasses can access its members even…
A: I have given an answer in step 2.
Q: Write an abstract superclass encapsulating a student. This abstract superclass named Student has two…
A: Required Java code with Screenshot of sample output provided below :
Q: Let’s consider a superclass Vehicle. Different vehicles have different features and properties…
A: //Vehicle.javapublic class Vehicle{ private String model; private String color; private…
Q: Design a Class Customerinsurance that implements Customer and Insurance interfaces, The Customer…
A: An interface in Java is a blueprint of a class. All the methods in an interface are abstract All the…
Q: Select one: O By default methods are virtual. O Only one object can be created from an abstract…
A: Answer :- The correct statement is If a derived class does not provide its own version of virtual…
Q: Variables with the same name as variables that have been declared in a superclass and variables that…
A: This question tells about Variables with the same name as variables that have been declared in a…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Using classes, design an online address book to keep track of the names, addresses, phone numbers, and dates of birth of family members, close friends, and certain business associates. Your program should be able to handle a maximum of 500 entries. Define a class addressType that can store a street address, city, state, and ZIP code. Use the appropriate functions to print and store the address. Also, use constructors to automatically initialize the member variables. Define a class extPersonType using the class personType (as defined in Example 10-10, Chapter 10), the class dateType (as designed in this chapters Programming Exercise 2), and the class addressType. Add a member variable to this class to classify the person as a family member, friend, or business associate. Also, add a member variable to store the phone number. Add (or override) the functions to print and store the appropriate information. Use constructors to automatically initialize the member variables. Define the class addressBookType using the previously defined classes. An object of the type addressBookType should be able to process a maximum of 500 entries. The program should perform the following operations: Load the data into the address book from a disk. Sort the address book by last name. Search for a person by last name. Print the address, phone number, and date of birth (if it exists) of a given person. Print the names of the people whose birthdays are in a given month. Print the names of all the people between two last names. Depending on the users request, print the names of all family members, friends, or business associates.Write an abstract superclass encapsulating a student. Thisabstract superclass named Student has two data fields:student’s ID and annual tuition. This abstract class has twononabstract subclasses: one encapsulating undergraduatestudents named Undergraduateclass, and the otherencapsulating graduate students named Graduate. Thisabstract superclass also has a getTuition() method and asetTuition(int tuition) method. The setTuition(int tuition) is onlyan abstract method. In Java The Undergraduate class has two additional data fields: nameand GPA. This class has also its own setTuition(int tuition)method .The Graduate class has one additional attribute:major. It also has its own setTuition(int tuition) method. You also need to include a class to test these two classes.Create an object from each subclass and call a method if anysubclass has it. Each class should have its own constructor and String toString()method.Create three classes Person, Professor and Student. Theclass Person should have data members name and age. Theclasses Professor and Student should inherit from theclass Person.The class Professor should have two integermembers: publications and cur_id. There will be two memberfunctions: getdata and putdata. The function getdata shouldget the input from the user: the name, age and publications ofthe professor. The function putdata should print the name,age, publications and the cur_id of the professor.The class Student should have two data members: marks,which is an array of size 6 and cur_id. It has two memberfunctions: getdata and putdata. The function getdata shouldget the input from the user: the name, age, and the marks ofthe student in 6 subjects. The function putdata should print 1,2,3,4,5,6,7,8,10,11 Students canbe able todevelop theProfessionalDataMaintenanceSystem. the name, age, sum of the marks and the cur_id of the student.For each object being created of the Professor…
- Design a class named CommunityMember and then create two subclasses named Student and Employee. Also create two subclasses of Employee for Faculty and Staff. A CommunityMember has a name, address, phone number, ande-mail address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as aconstant, e.g. status 1 for freshman, status 2 for sophomore, 3 for junior and 4 for senior. An Employee has an office, salary, and date Hired. For dateHired use class java.util.Date() to set the current date as dateHired. A faculty member has office Hours and a rank. A Staff member has a title either Senior or Junior. Override the toString method in each class to display the class name (i.e. CommunityMember, Student, Employee, Faculty, or Staff), the person’s name, and common data members, and specific data membersWrite a class LocalPhone that contains an attribute phone to store a local telephonenumber. The class contains member functions to input and display phone number.Write a child class NatPhone for national phone numbers that inherits LocPhoneclass. It additionally contains an attribute to store city code. It also containsmember functions to input and show the city code. Write another class IntPhonefor international phone numbers that inherit NatPhone class. It additionallycontains an attribute to store country code. It also contains member functions toinput and show the country code. Test these classes from main() by creatingobjects of derived classes and testing functions in a way that clear concept ofmulti-level Inheritance.Design a console program that will print details of prescribed textbooks of students. Make use of an abstract class Book with variables that will store the author, title, category and price of a book. Create a constructor that accepts the author, title and category through parameters and assign these to the class variables. Create an abstract set method for the price of a book; also create get methods for the variables.Create a subclass TextBook that extends the Book class and implements an iPrintable interface. The interface that must be added is shown below:public interface iPrintable { String DisplayDetails();}The TextBook subclass has a private variable named yearPrescribed for which a get method must be written. The constructor of the TextBook class must accept the author, title, category and yearPrescribed through parameters. Write the code for the setPrice() and DisplayDetails() methods.Write a useBook class and instantiate 2 objects of the TextBook class.
- Problem: Develop a class encapsulating the concept of a college course, assuming that a course has followingattributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include aconstructor, the accessors, mutators and methods ‘toString’, ‘equals’, and ‘finalize’. Write a client class to test thebehavior of the class and its methods. The outline of the class is given as follows: public class Course {private String course;private String description;private int credits;private int maxStudents;public Course( ) { }public Course (String course, String desc, int credits, int maxNum ) { }public String getCourse ( ) { }public void setCourse ( String c ) { }public String getDescription ( ) { }public void setDescription ( String desc ) { }public int getCredits ( ) { }public void setCredits ( int cred ) { }public int getStudents ( ) { }public void setStudents ( int students ) { }public String toString ( ) { }public boolean equals ( Object obj ) { }public…Fill in the blank space 1. The ____________ keyword is used to create a new instance or object of a class 2. ______________ is the concept of closely controlling access to an object's attributes and is also called information hiding 3. A ____________ is a method that is used 5o set the initial state of an object when it is created. 4. (i) Method _________ is the process of changing the number and type of parameters of a method (ii) Method __________ is the process of replacing a method in a superclass with a new implementation in the subclass 5. A ______________ expression is an expression that evaluates to either true or false. 6. In Java polymorphism means that a class or object can be treated as multiple different types. Which of the following statements regarding polymorphism in Java are true? Select all that apply. A. A subclass can be treated as any of it's ancestor (super) classes. B. A Java class can be treated as any interface it implements C. A Java class can be treated…Model a room class, whose member data is three integers length, width and height. The classcontains two constructors to initialize the room class objects, first is no argumentconstructor, while the second in three arguments constructor. Class also contains threemember functions i.e., getdatat) to get the data from user and store in the memory of callingobject and showdata) to show the room data of calling object, int volume(int I, int w, int h)function should receive the length, width and height values from the objects one by one andreturn the volumes of the three objects respectively.Write a main program to declare the three object rl, 12, and 13 of room class. Two objectwill store the values through three argument constructor and third object will get the datafrom user by calling getdata function. Then all three objects should call the volumefunctions to calculate their volumes and store them in three variables of type integer. Finallythe system compare the three volumes values…
- Create class employee with properties ID, name, salary, write accessor, mutator &constructor for the class. In main create three objects of class & find the employee with the highestsalary.1. Create a class RealEstate with the following details: Member variables: buildingID // building ID string type buildingName // name of the building string type Member Methods: · Parameterized constructor to set the member variables. · rentPrice(): An abstract method which calculates and return the rent. Defined in a subclass. · display(): To display the name & ID of the building. 2. Create a class Apartment that inherits RealEstate with the following details: Member variables: · noOfrooms // number of rooms int type · noOfBathroom // number of bath rooms int type · furnished // To check whether the furnished or not Boolean type Member Methods: · Define the parameterized constructor to set the member variables and also call the constructor of the superclass · Define the method rentPrice() which calculate and return the rent as given below:…A new class of objects can be created conveniently by —----------the new class (called the subclass) starts with the characteristics of an existing class (called the superclass), possibly customizing them and adding unique characteristics of its own.