According to the following, which is invalid? class Dog : Animal { } Question 9 options: Animal myAnimal = new Animal(); Dog myDog = new Dog(); Animal myAnimal = new Dog(); Dog myDog = new Animal();
Q: Please help me identify which is polymorphism and inheritance in the program, if none, please add.…
A: Inheritance is an OOP concept in which one class acquires all the properties and behaviors of…
Q: True or false ? Assuming class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; Quiz * p_quiz…
A: class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; //declare cs2b_quiz Quiz * p_quiz =…
Q: class City(object): county = "Lake" population = 3000000 def -_init__(self, name, state): self.name…
A: Task : Given the class City in python. The task is to find the set of commands that performs the…
Q: JAVA Part One: The Member Class Write the class to represent a member. Include the following…
A: Java is high-level OOP language. Java is also known for its rich set of class libraries, including…
Q: Colorful bubbles In this problem, you will use the Bubble class to make images of colorful bubbles.…
A: In this question we have to write a C++ graphics code for the bubble class with the given…
Q: build a student class implement the student class with the following instance variables: * id *…
A: The Python code is given below with output screenshot
Q: Take the following code: class Song private: string name; string author; string genre; int…
A: Answer: Code: class Song{ //this is class nameprivate: string name; string author;…
Q: Java Programming: ConWay World Conway’s game of life is a simple simulation of life forms in a two…
A: Hi.. check below for your program
Q: The following class sabo is included. Declaration section…
A: Statement "sabo p (2,4), q(3,2);" will create two objects of class sabo. Object 1: Name: p Values:…
Q: Default constructors are inherited from the base class, thereby eliminating the need for derived…
A: The answer is "False".
Q: Analysis the following class definition and answer the following question. class Student{…
A: The correct option is option e. age
Q: In order to use the assignment operator on an instance of a class data type, it must be overloaded.…
A: When one would think that default assignment operator is insufficient, then they should define their…
Q: Analysis the following class definition and answer the following question. class Store{…
A: Lets see the solution.
Q: The following class declaration has errors. Locate as many as you can. class Point {private: int…
A:
Q: Point out errors in the following codes and correct them publicclass CheckingAccount { // Create…
A: Please find the code below:: Highlighted line represent correction. package classes1;public class…
Q: Suppose a Student class extends Person class what is the value of boolean variable test after…
A: Given: Suppose a Student class extends Person class what is the value of boolean variable test after…
Q: Person and Customer Classes The Person and Customer Classes Write a class named Person with data…
A: Person Class:Define a class called Person.Inside the class, define the __init__ method that takes…
Q: ce Hstory Bill Details (String text, String textl, String text2) { n = text: ni - textl; = text2;…
A: To do: FIx the problem
Q: public class FoodItem { private String name; private double fat; private double carbs;…
A: 1public class FoodItem { 2 private String name; 3 private double fat; 4 private double carbs;…
Q: The following class declaration has errors. Locate as many as you can. class Yard{private:double…
A:
Q: e int a; e static int y = 10; numClass(int newX) X; } void set(int newX) X; y+=a; } public static…
A: Explanation: Here, first the value of y of one object is set to 30. Then, on object two the set…
Q: public class Stadium extends baseStadium{ public int typeTicket; int floors; int seating;…
A: The code includes three classes: Stadium, ticket, and baseStadium, and one interface TicketService.…
Q: Writing the setbank functions Setbalance Setaccont In order to enter the creditcard data instead of…
A: As per the requirement program is modified. Note: Newly added code is highlighted in bold. And both…
Q: True or false: A class may have a constructor with no parameter list, and an overloaded constructor…
A: Given:- True or false: A class may have a constructor with no parameter list, and an overloaded…
Q: T/F: Instance variables are shared by all the instances of the class. T/F: The scope of instance…
A: Answer- False. Instance variables are not shared by all the instances of the class. Instance…
Q: Problem Class In this exercise, you are going to create the Problem class. The Problem class is used…
A: Start. Create a class named "Problem" with private instance variables: "operator", "number1", and…
Q: Consider the following code segment and answer questions 14 and 15. class Point { public: Point…
A: A constructor is a unique method or function used in object-oriented programming that is invoked…
Q: private: int x, у;
A: Corrected Program: #include<iostream.h> #include<conio.h> class Point { private: int…
Q: The statement ( this("Employee #" + nextId, s); ) in the following code means that we are calling…
A: this refers to current instance
Q: Assignment:The BankAccount class models an account of a customer. A BankAccount has the…
A: Program: Filename: “BankAccount.java” // Import the required package import java.util.Date; // Class…
Q: Take the following code: class Song private: string name; string author; string genre; int…
A: Given code is: //setters are used change the value stored in one of an object's member variables…
Q: 1. In the CheckingAccount class: a. Create one method for depositing. The deposit method should…
A: Step 1 : StartStep 2 : Declare all variablesStep 3 : create deposit, withdraw, display methodsStep 4…
Q: class Player { protected: string name; double weight; double height; public:…
A: Note: since your question contain multiple subparts but we can answer only 3sub-parts at a time…
Q: What is the name of parameter used in setPrice?
A: We are given a code and in a function declaration we are asked which one is the function parameter?
Q: Given below is a UML diagram for address class. Address -Street: String -City: String -State: String…
A: Since there is the no language given. I am doing using c++ programming.
Q: Step 1: Extend the ItemToPurchase class per the following specifications: Private fields string…
A: Shopping Cart Program Algorithm1. Create the ItemToPurchase class. - Define private fields for…
Q: Java Programming Please do not change anything in Student class or Course class class John_Smith…
A: Hey there,I am writing the required solution for the above mentioned question below.
Q: ven the following class definition: class employee { public: employee(); employee(string,…
A: The code has given below
Q: Analysis the following class definition and answer the following question. class Student{…
A: class Student{ private int id, age; protected float mark;…
Q: Given below is a UML diagram for address class. Address -Street: String -City: String -State: String…
A: Here is the c++ code of the above problem. See below steps.
Q: What's the depth of inheritance for mobile phones? How many methods are overridden/overloaded…
A: As per our guidelines we are supposed to answer only 1st three parts. kindly repost the remaining…
Q: assignment: Create a class called Player that has the following attributes: Player Health -…
A: Create an instance of Player class with health, intelligence, dexterity, strength, and stamina…
Q: There are two types of data members in a class: static and non-static. Give an example of real-world…
A: Introduction Data members: Collectively, data members & member functions describe the properties…
class Dog : Animal { }
Question 9 options:
|
Animal myAnimal = new Animal();
|
|
Dog myDog = new Dog();
|
|
Animal myAnimal = new Dog();
|
|
Dog myDog = new Animal();
|
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- In order to use the assignment operator on an instance of a class data type, it must be overloaded. Group of answer choices True FalseC# languageCreate a class for “Plane” having functionalities (methods) startengine(), fly() and land(). When ever engine starts it should reset the attribute TTK (Total travel kilometer) to zero and attribute Fuel to 100. On fly() it should add 10 kilometers if the Fuel attribute is greater than zero and decrement Fuel by 20.On land() it should print total distance covered. Write the code providing all necessary details. And then show working object of Plane in main().class GradedActivity { private: double score; public: GradedActivity() { score = 0.0; } GradedActivity(double s) { score = s; } void setScore(double s) { score = s; } double getScore() { return score; } char getLetterGrade() const; }; Implement the GradedActivity class above. In this C++ assignment, create a new class Assignment which is derived from GradedActivity. It should have three private member ints for 3 different parts of an assignment score: functionality (max 50 points), efficiency (max 25 points), and style (max 25 points). Create member function set() in Assignment which takes three parameter ints and sets the member variables. It should also set its score member, which is inherited from GradedActivity, using the setScore() function, to functionality + efficiency + style. Signature: void Assignment::set(int, int, int) Create a main program which instantiates an Assignment, asks the user…
- class Player { protected: string name; double weight; double height; public: Player(string n, double w, double h) { name = n; weight = w; height = h; } string getName() const { return name; } virtual void printStats() const = 0; }; class BasketballPlayer : public Player { private: int fieldgoals; int attempts; public: BasketballPlayer(string n, double w, double h, int fg, int a) : Player(n, w, h) { fieldgoals = fg; attempts = a; } void printStats() const { cout << name << endl; cout << "Weight: " << weight; cout << " Height: " << height << endl; cout << "FG: " << fieldgoals; cout << " attempts: " << attempts; cout << " Pct: " << (double) fieldgoals / attempts << endl; } }; a. What does = 0 after function printStats() do? b. Would the following line in main() compile: Player p; -- why or why not? c. Could…Problem: Employee and ProductionWorker Classes Write a python class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3)• Hourly pay rateThe workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for this class. Once you have written the class, write a program that creates an object of the ProductionWorker class, and prompts the user to enter data for each of the object’s data attributes. Store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen Note: The program should be written in python. Sample Input/Output: Enter the name: Ahmed Al-AliEnter the ID number: 12345Enter the department:…T/F: Instance variables are shared by all the instances of the class. T/F: The scope of instance and static variables is the entire class. They can be declared anywhere inside a class. T/F: To declare static variables, constants, and methods, use the static modifier.
- Sanchez Construction Loan Co. makes loans of up to $100,000 for construction projects. There are two categories of Loans—those to businesses and those to individual applicants. Write an application that tracks all new construction loans. The application also must calculate the total amount owed at the due date (original loan amount + loan fee). The application should include the following classes: Loan—A public abstract class that implements the LoanConstants interface. A Loan includes a loan number, customer last name, amount of loan, interest rate, and term. The constructor requires data for each of the fields except interest rate. Do not allow loan amounts greater than $100,000. Force any loan term that is not one of the three defined in the LoanConstants class to a short-term, 1-year loan. Create a toString() method that displays all the loan data. LoanConstants—A public interface class. LoanConstants includes constant values for short-term (1 year), medium-term (3 years), and…Parent Class: Food Write a parent class called Food. A food is described by a name, the number of grams of sugar (as a whole number), and the number of grams of sodium (as a whole number). Core Class Components For the Food class, write: the complete class header the instance data variables a constructor that sets the instance data variables based on parameters getters and setters; use validity checking on the parameters where appropriate a toString method that returns a text representation of a Food object that includes all three characteristics of the food Class-Specific Method Write a method that calculates what percent of the daily recommended amount of sugar is contained in a food. The daily recommended amount might change, so the method takes in the daily allowance and then calculates the percentage. For example, let's say a food had 6 grams of sugar. If the daily allowance was 24 grams, the percent would be 0.25. For that same food, if the daily allowance was 36 grams, the…Analysis the following class definition and answer the following question. class Store{ protected int itemID, qty, double price; void setQty(int quantity){ qty = quantity; } protected void setPrice (double rate){ price = rate; } double amount(){ return qty*price; } } What is the name of parameter used in setPrice? a. rate b. protected c. price d. void e. double
- Assignment:The BankAccount class models an account of a customer. A BankAccount has the followinginstance variables: A unique account id sequentially assigned when the Bank Account is created. A balance which represents the amount of money in the account A date created which is the date on which the account is created.The following methods are defined in the BankAccount class: Withdraw – subtract money from the balance Deposit – add money to the balance Inquiry on:o Balanceo Account ido Date createdPLZ help wiith the following: IN JAVA If an inner class contains non static members, then the class name must be modified by the keyword: Final Static Void ProtectedSanchez Construction Loan Co. makes loans of up to R100,000 for construction projects. There are two categories of Loans—those to businesses and those to individual applicants. Write an application that tracks all new construction loans. The application also must calculate the total amount owed at the due date (original loan amount + loan fee). The application should include the following classes: •• Loan—A public abstract class that implements the LoanConstants interface. A Loan includes a loan number, customer last name, amount of loan, interest rate, and term. The constructor requires data for each of the fields except interest rate. Do not allow loan amounts greater than R100,000. Force any loan term that is not one of the three defined in the LoanConstants class to a short-term, 1-year loan. Create a toString() method that displays all the loan data. •• LoanConstants—A public interface class. LoanConstants includes constant values for short term (1 year), medium-term (3 years),…
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)