10 A class has to necessarily be declared as abstract class if
Q: A derived class inherits the __________ of its base class.
A: A derived class inherits the Definition members of its base class.
Q: Problem Statement with Hints 1. Write classes to hold Account, SB - Account and Current - Account…
A:
Q: __________ is where a derived class has two or more base classes.
A: GIVEN: __________ is where a derived class has two or more base classes.
Q: A(n) __________ member function in a base class expects to be overridden in a derived class.
A: Answer: A(n) __________ member function in a base class expects to be overridden in a derived…
Q: C# please create an abstract class named "Payment" and abstract method named "Authorized" . Create…
A: C#: C# is pronounced by C-sharp. It is developed by Microsoft. It is object oriented programming…
Q: True or False Polymorphism allows a class variable of the base class type to reference objects of…
A: Explanation: Polymorphism has on special capability, call the correct method based on object type…
Q: C# program implement base class human having 2 data member name and gender create another class…
A: Human Class: Class Human consists of: 2 data member: name and gender Constructors: Default and…
Q: is the term used to describe the process through which a member of one class becomes a member of…
A: Justification: Use the buddy keyword with the name of a non-member function or other class in a…
Q: If a class is abstract, what cannot be done with the class?
A: If a class is abstract, it implies that the class desires to hide the implementation details of it.…
Q: 1.9 When an object is instantiated from a class, it is then referred to as a(n): а. Inheritance of a…
A: Answer: The correct option is (b) => Instance of a class
Q: When deriving a class from a base class with public inheritance, public members of the base class…
A: When deriving a class from a base class with public inheritance, public members of the base class…
Q: When deriving a class with public inheritance, public members of the base class become…
A: Inheritance is a functionality provided by object oriented programming which allows the existing…
Q: If a class is derived privately from the parent class then . Select one: a.the compiler gives an…
A: The statement given is:- If a class is derived privately from the Parent class then . . .
Q: Abstract class can be inherited Abstract class defines only the structure of the class not its…
A: The question has been answered in step2
Q: T/F Example Code Ch 09-2Assume that Poodle is a derived class of Dog and that Dog d = new Dog(...)…
A: Please see the next step for solution.
Q: A base class reference variable may refer to a derived class object using .
A: Given, The property of Polymorphism, where a base class reference variable may refer to a derived…
Q: is the term used to describe the process of transforming a member of one class into a member of…
A: Introduction: The process of transforming a member of one class into a member of another:
Q: False O True Adding a derived class to a base class requires substantial changes to the base class
A: The question has been answered in step2
Q: Write a class Employee with attributes (employee_id, scale). The class contains member functions to…
A: Given: Write a class Employee with attributes (employee_id, scale). The class contains member…
Q: 2) The following graphic is an example of a (an) class. a) structural b) inheritance c) polymorphism…
A: 2) The following graphic is an example of a (an) class. a) structural b) inheritance c) polymorphism…
Q: T/F & Explanation Example Code Ch 09-2 Assume that Poodle is a derived class of Dog and that Dog d…
A: T/F & Explanation Example Code Ch 09-2Assume that Poodle is a derived class of Dog and that Dog…
Q: of the following elements of a parent class are NOT be inherited by a child class
A: The correct answer is private attributes
Q: T/F Example Code Ch 09-2 Assume that Poodle is a derived class of Dog and that Dog d = new Dog(...)…
A: True, even though p is not a dog it is legal.
Q: T/F Example Code Ch 09-2 Assume that Poodle is a derived class of Dog and that Dog d = new…
A: Please find the answer to the above question below:
Q: C#(Sharp): In an inheritance relationship, the ________________ is the general class Base class…
A: The correct option is option 1.
Q: Define access private member of a class
A: Let's see the solution in the next steps
Q: All virtual functions in an abstract base class must be declared as pure virtual functions T/F
A: Virtual function refers to a function which is defined in base class and it can be overridden in the…
Q: __________ allows a base class reference variable to reference a derived class object. a.…
A: Example: Suppose there is a Base Class Furniture class Furniture Now you derive a class…
Q: “Constructor cannot be inherited though derived class can call the base class constructor.” Justify…
A: Constructor cannot be inherited though derived class can call the base classconstructor. in any oop…
Q: True or False A statement that tries to use the new operator to instantiate an abstract class will…
A: Purpose of Abstract class: Abstract class is a class which acts as a base class for derived class…
Q: What is the purpose of an abstract class?
A: Abstract class: To make any class as an abstract class the programmer needs to use the abstract…
Q: T/F 23) Abstract classes are typically defined at the bottom of a class hierarchy
A: Please find the answer to the above question below:
Q: Write a base class Computer that contains data members of wordsize (in bits), memory size in…
A: A base class named Computer consists of some data members. A class Laptop is driven from this class.…
Q: Example Code Ch 09-2 Assume that Poodle is a derived class of Dog and that Dog d = new Dog(...) and…
A: please see the next step for solution
Q: A capability to acquire the properties of one class into other class is known as a. abstraction O b.…
A: Lets see the solutions.
Q: Fill-in-the-Blank If every C1 class object can be used as a C2 class object, the relationship…
A: Given: Fill-in blanks
Q: A base class is also identified as class Basic Super O Inherited O sub O O O
A: Language is one of the most widely used programming language which has been used to create different…
Q: Submit the following Zipped: 1) A UML Class Diagram of the the class/abstract data type. 2)…
A: UML DIAGRAM:
Q: c++ 1) make a crazy story like for worker or game of using inheritance // 2) you have to create 1…
A: Complete answer is given below .
Q: A has-a relationship is implemented via inheritance.T/F
A: Has a relationship means a child class accepting some of the property of base class. Like Car and…
Q: Create a parent class trailer which has member variable cargo and base class Transporter which has…
A: Inheritance is one of the key features of Object-oriented programming in C++. It allows us to create…
Q: Why would a class be declared as abstract?
A: REASONS TO DECLARE THE CLASS AS ABSTRACT: Abstract class are used for the purpose of providing…
Q: When we extend a class, the subclass's constructor only needs to call the super () constructor if we…
A: I have answered this question in step 2.
Q: oop using c++ please give me full answer thanks Write a base class Computer that contains data…
A: The ask is to - create a base class Computer with the given data members - derive a Laptop class…
Q: A class is made abstract by declaring that class virtual. T/F
A: Virtual Class : Virtual Class is a type of class in object-oriented programming in which the…
Q: Describe a benefit from allowing a new class to extend an existing class.
A: Inheritance is a technique by which a derived class extends a base class by using its member…
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Step by step
Solved in 2 steps with 1 images
- 1. Define an interface Measurable. It has a single abstract method: double getArea(); 2. Define an abstract class Shape which has two fields: type and name both of type Strin a. Provide constructor with a single input parameter: name. b. Provide accessor methods for both fields. C. Provide setter method for name. d. Provide toString() method that simply returns the "(type): (name)" e. Shape class implements Measurable interface without implementing its only abs method. 3.Create an abstract class named Course that can be used with course allocation mechanism of an enterprise. The Course class should track the course Id Number, course Title and course Credit Hours with appropriate accessor/getter and mutator/setter methods. Define an equals (Course obj) method, that returns true if caller and input argument course object have identical course Id Number. Also define an abstract method double getCourseEnrollmentFee(). Next, create two additional classes named ElectiveCourse and CoreCourse that are derived from Course. Finally, create an overridden method named getCourseEnrollmentFee() calculate and returns the total fee for that course. Elective course has Rs. 10,000 per credit hours and Core has Rs. 13,000 per credit hours.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.
- 1. Create abstract class Pet , which is the abstract super class of all animals.1. Declare an integer attribute called legs, which records the number of legs for this animal.2. Define a constructor that initializes the legs attribute.3. Declare an abstract method eat.4. Declare a concrete method walk that prints out something about how the animals walks (include the number of legs).2. Create the Dog class that implements Pet class.1. This class must include a String attribute to store the name and food of the pet2. Define a default constructor that calls the super class constructor to specify that all dogs have 4 legs and name.3. override the eat and walk method.3. Create the Cat class that Implements Pet class.1. This class must include a String attribute to store the name of the pet, and a string to save food .2. Define a constructor that takes one String parameter that specifies the cat's name. This constructor must also call the super class constructor to specify that all cats have…Create a project Vehicles in bluej. The project has Cars, Buses ,Trucks and Bikesclasses ,all these classes inherit from an interface Vehicle. Pedal_bikesand Motor_bikesare subclasses of abstract class Bikes. A.Show the relationship(class diagrams)between above mentioned classesand interfacesand write the necessary class definitions. B.Interface should have 3 methods: drive(), start() and stop(). C.abstract class Bikesshould have 2abstract methods: speed( ) and getModel( ). D.Which one of the following assignments are legal, why or why not? Justify. Pedal_bikes bik= new Motor_bikes( ); Vehiclev1 = new Buses (); Bikesbi= new Bikes( ) please use BlueJ program.Create an abstract NewspaperSubscription class with fields for the subscriber name, address, and rate. Include get and set methods for the name field and get methods for the address and subscription rate; the setAddress() method is abstract. Create two subclasses named PhysicalNewspaperSubscription and OnlineNewspaperSubscription. The parameter for the setAddress() method of the PhysicalNewspaperSubscription class must contain at least one digit; otherwise, an error message is displayed and the subscription rate is set to 0. If the address is valid, the subscription rate is assigned $15. The parameter for the setAddress() method of the OnlineNewspaperSubscription class must contain an at sign (@) or an error message is displayed. If the address is valid, the subscription rate is assigned $9. Finally, write an application that declares several objects of both subscription subtypes and displays their data fields
- This is the question - Create an abstract NewspaperSubscription class with fields for the subscriber name, address, and rate. Include get and set methods for the name field and get methods for the address and subscription rate; the setAddress() method is abstract. Create two subclasses named PhysicalNewspaperSubscription and OnlineNewspaperSubscription. The parameter for the setAddress() method of the PhysicalNewspaperSubscription class must contain at least one digit; otherwise, an error message is displayed and the subscription rate is set to 0. If the address is valid, the subscription rate is assigned $15. The parameter for the setAddress() method of the OnlineNewspaperSubscription class must contain an at sign (@) or an error message is displayed. If the address is valid, the subscription rate is assigned $9. Code I was given - public class DemoSubscriptions { public static void main(String args[]) { PhysicalNewspaperSubscription pnsGood = new…Create a class Animal and Add a protected data member named id of integer type. Add get/set methods for id data member in Animal class with public access. Also provide default constructor this should initialize id to 0. Also provide parameterized constructor and toString method. Add an abstract method tellAboutSelf method to Animal class with public access Add another abstract method speak method to Animal class. Reptile, Bird, Mammal Next create the three child classes which extends form Animal class. Add a default constructor to each of the above created class. The constructor should initialize the id data member id, Reptile, Bird and Mammal, to 1, 2 and 3 respectively also it display a message “(class Name)’s default constructor”. E.g. for Bird it says “Bird’s default constructor”. Add a parameterized constructor to each of the above created class. The constructor should initialize the id data member, Reptile, Bird and Mammal, to the specified id passed to the constructor also it…Create an abstract class Product with following Properties Price (Decimal), Code (string), Description (string) Create an interface ISellable with the following Method sell that takes the count of the products to sell and returns the cost public decimal sell(int count); Create a concrete class Book that Inherits from class Product and implements interface ISellable Has additional Property Author (string) Add a constructor with parameters, and ToString method to display all of data of class Book Similarly, create anot concrete class Software that Inherits from class Product and implements interface ISellable Has additional Property Version (string) Add a constructor with parameters, and ToString method to display all of data of the class Software Finally, write a client code (main program) that will utilize the class and interface hierarchy you created. Create two Book objects for the following books C# 8.0 in a Nutshell, with price $50.99 and with ISBN…
- Create an abstract super class called Employee with the following attributes: name : String and the following methods getter and setter for the one attribute three constructors an abstract method called getSalary() equals() toString() Create a sub class of Employee called Faculty with the following attribute yearlyPay : double department: String and the following methods getter and setter for the attributes three constructors getSalary() that returns the yearlyPay divided by 52 equals() toString() Create a sub class of Employee called Staff with the following attributes: hoursWorked : double payrate : double and the following methods getters and setters for the two attributes three constructors getSalary() that returns the weekly pay (multiply hoursWorked by payrate, overtime included and 1.5 times payrate for hours > 40) equals() toString() Create a sub class of Employee called Sales with the following attributes: salesAmount : double //sales per week Type:…1) Change the visibility of the variables and constructor in the Employee class to be more secure 2) Add an Admin class with the following features: a) The Admin class is a child of the Employee class b) Admin objects have an instance string password variable c) The Admin class has a 4 parameter constructor. One parameter sets the string, the other three parameters are used as arguments for a parent constructor call. d) Admin objects have an instance getInformation() method with a void return and an Employee object parameter. The method will request the calling Admin’s password and check user input. If input matches the password, the method will display the information of the Employee parameter Please use ***C Sharp** Language to answer the codeImplement all the classes using Java programming language from the given UML Class diagram. Note: This problem requires you to submit only one class: MyDate.java. Do NOT include "public static void main()" method inside all of these classes. The classes would be tested, using the unit-testing framework JUnit 4. A class called MyDate, which models a date instance, is defined as shown in the class diagram. The MyDate class contains the following private instance variables: year (int): Between 1 to 9999. month (int): Between 1 (Jan) to 12 (Dec). day (int): Between 1 to 28|29|30|31, where the last day depends on the month and whether it is a leap year for Feb (28|29). It also contains the following public static final variables (drawn with underlined in the class diagram): MONTHS (String[]), DAYS (String[]), and DAY_IN_MONTHS (int[]): static variables, initialized as shown, which are used in the methods. The MyDate class has the following public static methods (drawn with underlined in…