What OOP concept/mechanism is employed in the code below? 1-public class Plant { 2- String scientificName; 3- double price; 4- boolean isFruitBearing() { return false;} 5- boolean isFruitBearing (boolean cond) { 6- if (cond) return true; else return false; 7-} 8-} A. encapsulation OB. inheritance OC. extension OD. overriding OE. overloading OF. polymorphism
Q: Distinguish between the three pillars of Enterprise Architecture based on data and information.…
A: NOTE :- Below i explain the answer in my own words by which you understand it well. The…
Q: What are the benefits of using information and communications technology into educational and…
A: It has been demonstrated that the utilization of ICT in the homeroom builds the inspiration of the…
Q: For the purpose of offering customers the most value for their money, an airline sought a system…
A: Introduction: The Pareto Principle is almost universally used. The income generated by 20% of your…
Q: conversion from RGB to HIS colours is explained in detail
A: RGB process:- RGB stands for Red, Green and Blue colour. In the RGB process colours are represented…
Q: Is the use of the QR Code system going to be beneficial or detrimental to the services provided by…
A: QR Code system: A rapid response code, often known as a QR code, is a specific kind of…
Q: Declare and initialize a 2-dimensional array of int called num with the following values where each…
A: public class Main{ public static void main(String[] args) { //declaring 2d int array called num…
Q: Complete this code using Python m1 = [] #Matrix 1 m2 = [] #Matrix 2 #Write a function that will…
A: Code: m1 = [] #Matrix 1m2 = [] #Matrix 2 #Write a function that will return the addition of Matrix A…
Q: What causes connections to stay in the FIN WAIT 2 state, and what can you do about it?
A: Introduction: When the server has an active connection with a client and chooses to end the TCP…
Q: Ada Lovelace is best known for what, exactly?
A: Ada Lovelace: Ada Lovelace was born on December 10, 1815. Her father was a famed poet Lord Byron.…
Q: How do you compare two arrays of the same data type?
A: equals method It is used to compare the elements of two arrays. It has boolean result as output…
Q: five quality objectives we outlined earlier?
A: solution in below step
Q: 3- Implement onContextItemSelected(). When the user selects a menu item, the system calls this…
A: The getItemId() function looks for the ID for the selected menu item, which you should use the…
Q: 2/ The force between two charges is 120 N. If the distance between the charges is doubled, the force…
A:
Q: Would the cloud computing sector be affected if a major incident occurred? In the long run, what are…
A: The answer is given in the below step
Q: Question 7 What is the result of the following code? x = 10 y = 15 print (x = y) A 1 B none of these…
A: 7. x = 10 y = 15 print (x =y) #This will return type error , So The answer is option (B). None
Q: List the different types of security and explain each one with an example.
A: Introduction: It is the safeguarding of data against unauthorised access, theft, damage, any…
Q: H10. what are credible website ?
A: Note: As per the company guidelines we are suppose to answer only the first question. Kindly post…
Q: advancement of te
A: The impact technology has over daily life is truly increasing and expanding. Conferences are…
Q: Random rand-new Random(); int num= ; Fill in the blank to assign a random number between 25 and 75…
A: Code:
Q: Direct access to essential technology is hotly discussed in today's culture.
A: solution in step
Q: Please discuss the application of software system design and development in 5G mobile internet…
A: Mobile technology refers to the technology that goes where the person goes it is highly portable. It…
Q: List any four technologies that are used to create interactive and animated websites.
A: Introduction: Animated components may be created using the Document Object Model (DOM). Furthermore,…
Q: Visually display the most popular server OSes in use today
A: Even though there are several sorts of servers, I will address a Server Operating System. As of…
Q: Which of the following codes would return a True result? (A) TRUE FALSE B) "user"== "user" False >=…
A: 9. Option D is correct D. -6*14>=17-101 10. Option D is correct D. reshape 11. Option A is…
Q: Discuss the difficulties of concurrency in a multiprogramming system.
A: The concurrency in a multiprogramming system is running or executing more than one programs at a…
Q: What are the benefits of creating "connection points" across different networks? How do they factor…
A: Connection points: The attachment points are connected by a route, which is a path on a graph. It…
Q: How do the demands of a user differ from the requirements of a system, and how are these differences…
A: Given: The source of the issue, the user's world, is referred to as user requirements. They describe…
Q: Examine how an Intelligent Storage System provides huge capacity and high performance support for a…
A: Introduction: Big Data has piqued the interest of academics and the IT industry. In the digital and…
Q: A serious accident occurred on the National Highway, so an ambulance arrived immediately and the…
A: Coded using C++.
Q: Why did you choose Microsoft Excel above the other options available to you?
A: Programming accounting pages in Microsoft Excel has become a standard component of the majority of…
Q: i. Describe and illustrate the organization of a hard disk. (Hint: Include platters. tracks and…
A: i) Describe and illustrate the organization of a hard disk, A hard disk is a fixed unit containing…
Q: Can someone help me understand how to do binary search using arrays?
A: Searching is a process of finding a particular element in a list. There are two types of searching…
Q: ?is a '=' Relational operator O Assignment operator O Operational operator O Arithmetic operator O
A: ? = is a
Q: Suppose you're using WPA2 as your wireless connection. Describe why this choice is better than the…
A: WiFi-Protected Access 2 (WPA2): WPA2 adds to WPA's wireless network security. It improves data and…
Q: What do you know about wireless security? Discuss and evaluate your thoughts.
A: Examine and discuss your knowledge of wireless security. ANSWER: Unauthorized access to devices or…
Q: In order for a network to be functional and efficient, what three things must it have? In your own…
A: An organisation should: Be able to choose whether or not to follow a set of rules. For a sustainable…
Q: Explain any two features that can enhance a hub's intelligence.
A: Introduction: As a multiport repeater, a hub is similar to that. In a star architecture, for…
Q: Does the methodology used to erase data have any ramifications for Symbian, Android, or iPhone…
A: Artificial intelligence is the ability to think rationally, or to depict thinking as a logical…
Q: A serious accident occurred on the National Highway, so an ambulance arrived immediately and the…
A: Input/Output Process: First line contains five space separated integers N, M, R, X and Y denoting…
Q: Assume that the public concrete class House is defined, which of the following statements is ALWAYS…
A: Object class can be defined as the element or the instance of a class. Object can be recognized as…
Q: ter system? For example, what are the advantages and disadvantages of a big / high capacity TLB
A: Is a big or a small TLB (translation look aside buffer) preferable for a new computer system? For…
Q: If these three conditions aren't met, how can a network be effective and maximise its potential?…
A: Given: Successful networking partnerships take a genuine interest in their contacts and go to great…
Q: Write a program that creates a 32-element array of random integers all from 1 to 100, inclusive.…
A: Please check the step 2 for required code and step 3 for sample output.
Q: Are there advantages and disadvantages to using a formal methodology? It is important to utilise…
A: advantages 1.Complexity of the formal method is low. 2.It is self-consistent because of its…
Q: What distinguishes ubiquitous computing, also known as pervasive computing, from traditional desktop…
A: Introduction: Computing Pervasive Pervasive computing refers to the incorporation of computer…
Q: What does DES (data encryption standard) mean?Explain.Please do it the right way. Information…
A: Introduction: Because DES encrypts and decrypts a message with the same key, both the sender and the…
Q: ss Point: """ A point in a two-dimensional coordinate plane """ def…
A: The move method in WindTurbine calls the move method from Rectangle, which causes the turbine's…
Q: If a project like mobile banking includes the creation of new technologies, how might the four…
A: A model with four frames: The Four Frame Model is a conceptualization that splits every organization…
Q: What role do databases play in three-tier apps?
A: Intro Three-tier application: The most common client-server design in relational database…
Q: Consider the drawbacks of a weighted graph representation using an adjacency list representation.
A: The question is to consider the drawbacks of a weighted graph representation using an adjacency list…
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
- public class FoodItem { private String name; private double fat; private double carbs; private double protein; // TODO: Define default constructor // TODO: Define second constructor with parameters to initialize private fields (name, fat, carbs, protein) public String getName() { return name; } public double getFat() { return fat; } public double getCarbs() { return carbs; } public double getProtein() { return protein; } public double getCalories(double numServings) { // Calorie formula double calories = ((fat * 9) + (carbs * 4) + (protein * 4)) * numServings; return calories; } public void printInfo() { System.out.println("Nutritional information per serving of " + name + ":"); System.out.printf(" Fat: %.2f g\n", fat); System.out.printf(" Carbohydrates: %.2f g\n", carbs); System.out.printf(" Protein: %.2f g\n", protein); }} import java.util.Scanner; public class NutritionalInfo {…2. Add a constructor for Animal class shown. The constructor should pass in a string parameter named "sound". 1 using System; 2 3 public class Animal 4 { 5 public string Sound { get; set; } public void Speak() { Console.Writeline("The dog says " + Sound); } 10 11 } 12 13 public class Program 14 { public static void Main() { 15 16 17 18 } 19 } A 00class 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…
- Java Assignment Outcomes: Student will demonstrate the ability to utilize inheritance in a Java program. Student will demonstrate the ability to apply the IS A and HAS A relationships. Program Specifications: Start by watching Video Segment 16 from Dr. Colin Archibald's video series (found in the module overview). Key in the program shown in the video and make sure it works. Then, add the following: Animals have a Weight. Animals have a Height. Dog is an Animal. Dogs have a Name. Dogs have a Breed. Dogs have a DOB. Cat is an Animal Cats have a Name. Cats have 9 lives, so you need to keep track of the remaining lives once a cat dies. Bird is an Animal Birds have a wing span Birds have a canFly which is true or false (some birds cannot fly) Create a test class that creates one of each type of animal and displays the animal’s toString method. Submission Requirements: You must follow the rules from the prior assignments. UMLs and Design Tools are not required for this one. YOU MAY…True or False Properties in a base class cannot be overridden in the same way that methods can be overridden.7. public class Father { public String name; public int age; // customer name Father(){ name="Hassan"; age=50;} public void display(){ System.out.println("Name:"+name); System.out.println("Age:"+age); }} Figure 3 i. Based on Figure 3, create a class named Child that inherits the Father class. Declare an instance name location (String) for class Child. ii. Define a constructor in class Child and give an appropriate initial values for the instance (name, age, location). Define a method display () in class Child, execute the display () method in superclass using the keyword super. Method display () in class Child should print the information of name, age and location. ii.
- Q 3: Different packages and access modifiers package package_02; public class ClassB { public int x = 1; int y = 2; private int z = 3; public void myMethod() { System.out.print(x); System.out.print(y); System.out.print(z); } } package package_01%; import package_02.ClassB; public class ClassA { public static void main(String] args) { ClassB cb = new ClassB(); cb.myMethod(); } } 3.1- Which statement(s) are true? Choose all that apply. a. This code prints "123" to the output. b. If you remove the "public" modifier from the ClassB, the code writes "123" to the output. c. If you remove the "public" modifier from the method myMethod, the code prints "123" to the output. d. This code does not compile 3.2- What do you expect if you remove the public keyword from the ClassB (public class ClassB{..})?Q:-Write a statement in ClassA to check out the accessibility of your variable. package package_02; public class ClassB { public int x = 1; int y = 2; private int z =3; } package package_01; import package_02.ClassB; public class ClassA { public static void main(String[] args) { ClassB cb = new ClassB(); // System.out.print(cb.x); /* 1 */ // System.out.print(cb.y); /* 2 */ // System.out.print(cb.z); /* 3 */ } }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…
- Remaining Time: 35 minutes, 18 seconds, ¥ Question Completion Status: A class named Account is defined as the following. class Account } private: int id; double balance; public: //A constructor without parameter that creates a default account with id 0, balance 0 Account): /A constructor with the parameter that setting the id and balance Account(int, double), int getId); / return the ID double getBalance() //return the balance void withdraw(double amount) // the amount will be withdrawn void setlID(int), //set the ID void setBalance (double) //set the balance }: Assume that we will create a separate file of implementation of the function definition for the questions a) -b) a) Write a construction function definition with two parameters (ID and balance). b) Write a function definition of the function declaration (void withdraw(double amount):). c) Creates an Account object with an ID (1122) and balance ($20000). Then, write source codes to withdraw $2 MacBooclass A{ protected int al; protected double a2; protected boolean a3; public A() { a1 = 0; a2 = 0; a3 = false; System.out.printin("A's Default Constructor."); } public A(int al, double a2, boolean a3) { this.al = al; this.a2 = a2; this.a3 = a3; System.out.printIn("A's Overloaded Constructor."); } } class B extends A{ protected char b1; public B() { b1 = ' "; System.out.printin("B's Default Constructor."); } public B(int al, double a2, boolean a3, char b1) { this.al = al; this.a2 = a2; this.a3 = a3; this.b1 = b1; System.out.printin("B's Overloaded Constructor."); } } class C extends B{ protected String c1; public C() { super (); c1 = " ; System.out.print]n("C's Default Constructor."); } public C(int al, double a2, boolean a3, char b1, String c1) { super (al, a2, a3, b1); this.c1 = c1; System.out.printin("C's Overloaded Constructor."); } } ignoring the 'time left' message, Check the above code and specify which object declaration generates an error. Question 1Answer A obj2 = new A(1,…C# 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().