Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Imagine that you’ve written a JavaScript constructor for a custom clownfish object with a position property and then added the following statements:
clownfish.prototype.swimForward = function(distanceInCm) {
this.position += distanceInCm;
};
Now you would like to apply the swimForward() method to a similar custom object called lionfish. What statement(s) could you use to do this?
a.
You can call theswimForward()method only on objects of theclownfishclass because it is a private method.
b.
let spikey = new clownfish();
lionfish.prototype.swimForward.call(spikey, 50);
c.
let spikey = new lionfish();
clownfish.prototype.swimForward.apply(spikey, 50);
d.
let spikey = new lionfish();
clownfish.prototype.swimForward.call(spikey, 50);
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- For this lab task, you will work with classes and objects. Create a class named text that works similar to the built-in string class. You will need to define a constructor that can be used to initialize objects of this new class with some literal text. Next, define three methods: to_upper() that will convert all characters to uppercase, reverse() that will reverse the text and length() that will return the length of the text. After you have completed this part, copy the following mainfunction to your code and check if the implementation is correct. int main() { text sample = "This is a sample text"; cout << sample.to_upper(); // This should display "THIS IS A SAMPLE TEXT" cout << endl;cout << sample.reverse(); // This should display "txet elpmas a si sihT"cout << endl; cout << sample.length(); // This should display 21 }arrow_forwardUsing comments within the code itself, can you provide an line by line explanation of the below JavaScript file? The file itself deals with WebGl and if that helps you. Please & thank you JavaScript File: function inverse2(m) { var a = mat2(); var d = det2(m); a[0][0] = m[1][1]/d; a[0][1] = -m[0][1]/d; a[1][0] = -m[1][0]/d; a[1][1] = m[0][0]/d; return a; } function inverse3(m) { var a = mat3(); var d = det3(m); var a00 = [ vec2(m[1][1], m[1][2]), vec2(m[2][1], m[2][2]) ]; var a01 = [ vec2(m[1][0], m[1][2]), vec2(m[2][0], m[2][2]) ]; var a02 = [ vec2(m[1][0], m[1][1]), vec2(m[2][0], m[2][1]) ]; var a10 = [ vec2(m[0][1], m[0][2]), vec2(m[2][1], m[2][2]) ]; var a11 = [ vec2(m[0][0], m[0][2]), vec2(m[2][0], m[2][2]) ]; var a12 = [ vec2(m[0][0], m[0][1]), vec2(m[2][0], m[2][1]) ]; var a20 = […arrow_forwardI'm working on a Visual Studio Code project on Inheritance. Create a new project. So you'll have the project.cs file, and then make a Vehicle.cs file with the following attributes. Class Vehicle will be the overall base class and will have the properties and methods described below Wheels - type integer, the number of wheels the vehicle has Color - type string, the color of the vehicle Moving - type Boolean, indicator of whether or not the vehicle is currently moving Seats - type integer, the number of seats available in the vehicle Now I'm unsure on how I would connect that back to the program.cs file. That is what I need to see. Thanks.arrow_forward
- Suppose you have written constructors for two JavaScript object classes, Fruit and Kiwi, and you want the properties and methods of the Fruit class (the base class) to be shared with the Kiwi class. What statement can you use to chain these object classes together in this way? Question options: A Fruit.prototype = new Kiwi(); B Kiwi.prototype = new Fruit(); C let Kiwi = new Fruit(); D let Fruit = new Kiwi();arrow_forwardPlease add the code after this one. The code has to be in java eclipse. Please add comments in what you are doing. I'll appreciate it public class Computer { private String ModelNumber; private String BrandName; private String manufacturingDate; private int NumberOfCores; //Constructor a public Computer() {} //Construct a computer object with model, BrandName, NumberOfCoresComputer (String ModelNumber, String BrandName, String manufacturingDate, int NumberOfCores){ this.ModelNumber=ModelNumber; this.BrandName=BrandName; this.manufacturingDate=manufacturingDate; this.NumberOfCores=NumberOfCores;}//generate getters/setterspublic String getModel() { return ModelNumber;} public void setModel(String ModelNumber) { ModelNumber = ModelNumber;} public String getBrandName() { return BrandName;} public void setBrandName(String brandName) { BrandName = brandName;} public String getManufacturingDate() { return manufacturingDate;} public void setManufacturingDate(String…arrow_forwardWrite a program that will use WheelsFX shapes to create a Car. There is a size requirement; the Car should fit inside the box that appears on the start-up program. You will be able to change or refine your car over the next several assignments if you so choose. Be creative, your Car can also be something purely out of your imagination if you so choose. Pick one of your shapes. In English, what will you need to do to take it from the default that we get when we create the shape to what you need to build that part of your Car? Now take the shape that you wrote out in question 2 and now write what the Java code would be. Pretend that you were writing this program in C++ instead of Java. Take the code you wrote in question three and now re-write it to look like it would in C++. For the object, you must use a pointer variable. Looking at your answers for questions three and four, what differences do you see syntactically? What does this mean going forward for other objects we work with? The…arrow_forward
- We already have the address and vehicle class for the system below. We will need a CarShow class with IsSanctioned() method, Owner class with IsOwner method and a main class that creates objects and implements all our existing classes. Use the class diagrams. Make sure to include respective attributes, setters, getters and constructors in your code Explain your code in a few words.arrow_forwardPlease help me fix the errors in the java program below. There are two class AnimatedBall and BouncingBall import javax.swing.*;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;public class AnimatedBall extends JFrame implements ActionListener{private Button btnBounce; // declare a button to playprivate TextField txtSpeed; // declare a text field to enterprivate Label lblDelay;private Panel controls; // generic panel for controlsprivate BouncingBall display; // drawing panel for ballContainer frame;public AnimatedBall (){// Set up the controls on the appletframe = getContentPane();btnBounce = new Button ("Bounce Ball");//create the objectstxtSpeed = new TextField("10000", 10);lblDelay = new Label("Enter Delay");display = new BouncingBall();//create the panel objectscontrols = new Panel();setLayout(new BorderLayout()); // set the frame layoutcontrols.add (btnBounce); // add controls to panelcontrols.add (lblDelay);controls.add…arrow_forwardPlease help me with this questionarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education