Base classes are sometimes called __________. a. megaclasses b. primitive classes c. starter classes d. superclasses
Q: Write a class HarvardLawyer to accompany the other law firm classes described in this chapter.…
A: Write a class HarvardLawyer to accompany the other law firm classes described in this chapter.…
Q: Suppose you have implemented a collection of asset subclasses in a manner similar to the stock…
A: The portfolio display method summarizes the portfolio contents (because this statement is not…
Q: Given the following code for the base class Ship write another class that inherits from Ship called…
A: Below is the required code and sample output:
Q: n JAVA: A subclasss of you bicycle class for a mountain bicycle, as described in the section:…
A: import java.util.*; //Bicycle interface interface Bicycle { abstract void changeCadence(int…
Q: create a class that captures planets.
A: Classes in C++ In C++, a class is created using the keyword 'class' which must be followed by the…
Q: A class Person is given below as your base class. Your task is to create a class Employee which will…
A: The solution to the given problem is below.
Q: Using interfaces, you can specify similar behaviors for possibly disparate classes. Governments and…
A: It is defined as the programs can be asked from control statements, array, string, oops etc. Java…
Q: (in java) Part A: Create a class named Insect, which includes the following: 1. Attributes…
A: Given: Part A: Create a class named Insect, which includes the following: 1. Attributes including:…
Q: Part 3. Create two Child Classes Create two Java classes, Desktop and Laptop that both are…
A: The java code is given below.
Q: 3. Next to these lines, add the following code. class Apple int x - 5; Apple() {…
A: Super Keyword in Java: The super keyword in Java is a reference variable that is used to refer to…
Q: How many constructors can be defined in a class? а. 1 b. 2 c. Any number of constructors with…
A: Question from basic core java. In this question, they asked that how many constructors can be…
Q: If class Apple extends class Fruit, which of the following is also true? O Fruit is the super class…
A: Correct Answer: - All of the above For Fruit is the super class of Apple It is correct because…
Q: JAVA HELP! Can you add questions and covert chapter numbers into points and make an application…
A: Given: Add the eight classes from the UML class diagram in a package called “testsimulator” as shown…
Q: If I have a class titled MyClass, then which of the following is a valid constructor header? O def…
A: 1) A constructor is a special type of method or function which is used to initialize the instance…
Q: Create a Warrior class that has properties given below. • String name, • int health, • int strength.…
A: Required: Create a warrior class that has properties as:string name int health int strength.
Q: What do you call a class that inherits a class? Select one: O a. Superclass O b. Class O. Subclass O…
A: Question 1: Inheritance is defined as a mechanism in which one object acquires all the properties…
Q: Assume that you write a class Student that does not have a declared superclass. You do not write a…
A: Solution) String "s" will have the string Student@address
Q: Write the DemonSlayer class so that the code gives the expected output. [You are not allowed to…
A: DemonSlayer is the class name and it has instance variables name, style, number_of_technique and…
Q: write a class called OneItemBag ( OneItemBag.java ). This class represents a bag that can hold any…
A: According to the question, we have to write code for a class called OneItemBag ( OneItemBag.java ).…
Q: Create a class called Employee as a a derived class of the class Person. An employee record has an…
A: PROGRAM INTRODUCTION: Define a class named Person. Start definition of another class then extends…
Q: A) Create a super (parent) class called Course. The Course class represents any course that does not…
A: NOTE: Programming language is not mentioned, so I am doing in JAVA In this question, there are three…
Q: eate a class named Employee that can be used to calculate the salaries of different employees. The…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: 10.4 (The MyPoint class) Design a class named MyPoint to represent a point with X- and…
A: Define a class named "MyPoint". Declare the private variables named "x" and "y" in type of "double".…
Q: Write a class called Triangle with the required constructor and methods to get the following output.…
A: Since the question doesn't include the programming language use to code the problem so I am using…
Q: Write a class called Triangle with the required constructor and methods to get the following output.…
A: Here, we have to write a python program for the above problem using the encapsulation topic.
Q: Write a class encapsulating a board game, which inherits from Game. A board game has the following…
A: public class Client{ public static void main(String[] args) { BoardGame bg=new BoardGame("Ludo",…
Q: Create a Warrior class that has properties given below. String name, • int health, • int strength.…
A: Program is written in java language. Program code for Part 1: public class Warrior { //Declare…
Q: A: Create a class called Computer. Add two additional classes; Laptop and Smartphone. Add the…
A: A: Computer.java file: public class Computer { protected int ram; protected int storage; protected…
Q: Assume that you have a class Apple which is a subclass of Fruit. Which statement can be used in…
A: A class which is derived from another class is called a subclass or child class and from which class…
Q: Write an Employee class that keeps data attributes for the following pieces of information: (a).…
A: Below is the complete python program for the same. Note: While copying the code below please take…
Q: Create a "house" class that initializes house objects in the following way :…
A: """Program to create a class house, intialze it, get user monthly saving and display monthsneeded to…
Q: Create a new Teller Class Build a new Teller class(“Teller.java”). This class will be a sub-class of…
A: Given: Create a new Teller Class Build a new Teller class(“Teller.java”). This class will be a…
Q: If you assign a new instance of a subclass object to a super-class variable without casting, what…
A: This involves the concept of Inheritance in object oriented programming.
Q: Design the Player class so that the code gives the expected output. [You are not allowed to change…
A: According to the provided information: We need to create a python code in which takes the Player's…
Q: Write a CashRegister class that can be used with the RetailItem class that you wrote in Chapter 6’s…
A: *************CashRegister.java***************** public class CashRegister { // These are…
Q: Create a class named “Cricket” having the following private data members:…
A: **CHANGE THE VALUE IN LINE NO. 233 (int size=??) to 10 SINCE ONLY 3 BATSMAN AND BOWLERS DETAILS HAVE…
Q: Create a base class called “Animal” which has two (2) class fields. The first field holds an integer…
A: class Animal{ int IDtag; String species; Animal(int IDtag,String species){ this.IDtag=IDtag;…
Q: Write a derived class of the NumberGuesser class named RandomNumberGuesser. The derived class…
A: Answer :
Q: Encircle/ write down the correct/missing code.Elaborate if needed by writing a comment. //this…
A: This is a simple code debugging question in java.
Q: a) Create a class called BankAccount which represents a bank account having the following…
A: create a class called BankAccount which represents a bank account having following attributes-…
Q: If you assign a new instance of a subclass object to a super-class variable without casting, what…
A: Let us see the answer,
Q: Create a time class that accepts hours, minutes and seconds. Define appropriate getter/setter…
A: Program Approach: Defining a class "Time" inside the class three sting variable "hour, minute, and…
Q: Write code in java Create a class named Employee that can be used to calculate the salaries of…
A: /* * To change this license header, choose License Headers in Project…
Q: Create a base class and also a class that is derived from the base class. The base class needs to…
A: Program: #include <iostream> #include <iomanip> using namespace std; //Animal…
Q: What is inherited in a subclass from its superclass? O class members O constructors O class members…
A: A subclass inherits all the members (fields, methods, and nested classes) from its superclass.…
Q: Device is a class. Computer is a subclass of the class Device. How can we invoke the constructor of…
A: To invoke the constructor of the class Device in the subclass Computer, we use the (c)…
Q: Which of the statements regarding the super keyword is incorrect? You can use super to invoke a…
A: What is super Keyword? The super key-word is used to get entry to the member variables and the…
Q: Block class The Block class inherits from Drawable and it will draw a square with a black outline at…
A: The Drawable class is implemented as shown. Class Block inherits class Drawable and implements the…
Base classes are sometimes called __________.
a. megaclasses
b. primitive classes
c. starter classes
d. superclasses
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Create a base class called “Animal” which has two (2) class fields. The first field holds an integer “IDtag” for a number that a zoo uses to catalogue their animals and the second field holds a string called “species.”From the Animal class, derive two (2) classes. One is called “Bird” and the other “Reptile”. E.g. Species could be (for the Bird class) ostrich, dove, chicken etc. and (for the Reptile class) lizard, snake, bearded dragon etc.The Bird class has an additional class field called “colour” which holds the colour of the birds feathers (int – 1=grey, 2=white, 3=black). The reptile class has an additional class field called “bloodTemp” which hold the reptile’s temperature of their blood (double).You need to instantiate two (2) objects. The bird object will be called “brd” and the reptile object called “rept.”Input values for the bird’s IDtag, species and feather colour (int) and for the reptile’s IDtag number, species and bloodTemp. Override the Animal class’s input and output…A. Create a BankAccount class. We want to be able to create a new bank account, make deposits and withdrawals, and check the balance. Each bank account created should receive a unique account id, numbered sequentially 1001, 1002, 1003, and so on. We should be able to change the name on the account. We should also be able to retrieve the account id and the name on the account. Provide a constructor that takes a name for the account as a parameter. Remember that a constructor has the same name as the class. The constructor should initialize all of the instance variables. What does the class need to remember? Those are the instance variables. There should be three. Provide the following methods: public double getID() gets the account id of this BankAccount public double getBalance() gets the balance of this BankAccount public String getName() gets the name of this BankAccount public void setName(String newName) sets a new name for this BankAccount public void deposit(double…JAVA HELP! Can you add questions and covert chapter numbers into points and make an application that calls them over 100? Create a new NetBeans 8.2 Java 8 project called TestSimulator.Add the eight classes from the UML class diagram in a package called “testsimulator” as shown below. Create a class stub for each class such as below:public class ClassName { }Add the necessary additional keywords for classes that inherit from interfaces or abstract classes.Part 2:Main menu Consult the UML class diagram and add implementation to the TestSimulator class as follows:getSelection() method: • Print the following menu-based messages:Welcome to the TestSimulator program menu.Select from one of the following options.(1) New test. (2) Test summary. (3) Exit. Enter your selection:• Accept the choice from the user. • Ask the user to enter their choice again if a non-number is received.main() method: • Add a loop that runs the getSelection() method until the user enters option (3). • Add a…
- Assume we have a class called Phone with variables size, weight, type, It has a string array called apps, and a variable called number_of_apps. A subclass is called SumsangPhone, which has a variable called operating_system. Write the constructor for the Sumsang Phone.A class Person is given below as your base class. Your task is to create a class Employee which will contain objects of records for an employee and derived from the class Person. Guideline for an employee record: employee's name (which is inherited from the class Person) annual salary represented (type double) year the employee started work (type int) company ID number (type String) with a format of EMPXXX (where X are numbers) Create constructors and accessor methods which you think are needed for this program, as well as another method (print) to print out all the employee’s data once you call that method. Finally, create your TestEmployee class which will contain a main method to fully test your class definition. public class Person{ private String name; public Person(){ name = "No name yet."; } public Person(String n){ name = n; } public void setName(String newName){ name = newName; } public String getName(){ return name; } public void print(){…in Java Part 1 : Start by creating a new class called MyPoint that can be initialized with either of these constructors: MyPoint p1 = new MyPoint(); MyPoint p2 = new MyPoint(2.0, 4.0); The two arguments given to the constructor are x (2.0) and y (4.0) co-ordinates. Don’t forget to include getters and setters as these should be private instance variables! Part 2 : Create a toString() instance method that prints out the co-ordinates of the point. Add two instance methods that return the Euclidean distance to another point, or to another (x, y) coordinate. Example: double distance = p2.distance(p1); The Euclidean distance between two points is: d=√x^2 + y^2 You will need to make use of methods from the Math package: https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Math.html Test your constructors and the new methods. Part 3 : Create a class method, contains(MyPoint[] points, MyPoint p), that checks if the point p is in the array points and returns a boolean.…
- {In Java Programming Please} Create a class hierarchy that represents different types of employees in a company. Start with a class called Employee that has two methods: calculateSalary() and displayDetails(). Then, create two subclasses of Employee: Manager and Engineer. Override the calculateSalary() method in both subclasses to calculate the salary based on their job role and experience. Override the displayDetails() method in both subclasses to print out a message indicating the details of the employee. Next, create another class called Salesperson that extends Employee and has a method called calculateCommission(). Create two subclasses of Salesperson: SeniorSalesperson and JuniorSalesperson. Override the calculateCommission() method in both subclasses to calculate the commission based on their sales performance. Override the displayDetails() method in both subclasses to print out a message indicating the details of the salesperson. In the main method, create objects of each class…Create a class called Employee as a a derived class of the class Person. An employee record has an employee's name, address, gender(inherited from the class Person), an ID number whose type is String, an annual salary represented as a single value of type double, and a year the employee started work as a single value of type int. Your class should have a reasonable number of constructors and setter methods, as well as getter methods. Write another class containing a main method to fully test your class definition.write a class called OneItemBag ( OneItemBag.java ). This class represents a bag that can hold any single type of object (decided at bag-creation time), and only one item of that type at a time. You may have a zero-parameter constructor if you want one, but you must have the following three features:1. a method that puts an item in the bag (addItem()) which returns whether or not it was successfully added2. a method that removes an item from the bag and returns it (removeItem()), return null if there is no item3. a method to check if an item is in the bag (hasItem()) which returns true or false
- Create two public classes: Mammal and Bird. Each should inherit from the Animal class shown below. For each new class, override the giveBirth method to produce the following output: For the Mammal class, the method should return: "I give live birth" For the Bird class, the method should return "I lay eggs" class Animal: """This is an animal""" def giveBirth(self): """Return the birthing method""" return "I don't know how"write in java Write a CashRegister class that can be used with the RetailItem class that you wrote inChapter 6’s Programming Challenge 4. (in the attachments) The CashRegister class should simulate the sale ofa retail item. It should have a constructor that accepts a RetailItem object as an argument.The constructor should also accept an integer that represents the quantity of items beingpurchased. In addition, the class should have the following methods:• The getSubtotal method should return the subtotal of the sale, which is the quantitymultiplied by the price. This method must get the price from the RetailItem objectthat was passed as an argument to the constructor.• The getTax method should return the amount of sales tax on the purchase. The salestax rate is 6 percent of a retail sale.• The getTotal method should return the total of the sale, which is the subtotal plus thesales tax.Demonstrate the class in a program that asks the user for the quantity of items being purchased,and…Assume that you write a class Student that does not have a declared superclass. You do not write a toString method. Consider the following lines of code:Student st = new Student();String s = st.toString();Will these lines compile? If so, what exactly will happen when you try to execute?