My orders
How it works
Examples
Reviews
Blog
Homework Answers
Submit
Sign in
How it works
Examples
Reviews
Homework answers
Blog
Contact us
Submit
Fill in the order form to get the price
Subject
Select Subject
Programming & Computer Science
Math
Engineering
Economics
Physics
Other
Category
C++
Software Engineering
Java | JSP | JSF
Databases | SQL | Oracle | MS Access
C
Python
Excel
C#
Visual Basic
Computer Networks
Functional Programming
Android
Assembler
UNIX/Linux Programming
ASP | ASP.NET
MatLAB
Wolfram Mathematica
MathCAD
Maple
Perl
Action Script | Flash | Flex | ColdFusion
Ruby | Ruby on Rails
Prolog
Objective-C | Swift
Algorithms
Web Development
HTML/JavaScript Web Application
NodeJS Web Application
Other
Deadline
Timezone:
Title
*
Task
*
{"ops":[{"insert":"Submarine\n\nGiven two numbers \ntotalTorpedos, torpedosFired as inputs, write a super class Submarine with property and methods as below,\n\nPropertyDescriptionisSubmergedIt should contain a boolean value to indicate whether the submarine is submerged or not.\n\nMethodDescriptiondiveWhen this method is called, it should set the value of\u00a0isSubmerged\u00a0to true and log\u00a0"},{"attributes":{"italic":true},"insert":"\"Submarine Submerged\""},{"insert":"\u00a0text in the console.surfaceWhen this method is called, it should set the value of\u00a0isSubmerged\u00a0to false and log\u00a0"},{"attributes":{"italic":true},"insert":"\"Submarine Surfaced\""},{"insert":"\u00a0text in the console.\nAdd a sub class weaponUnit which extends to Submarine with the below properties and methods,\nPropertyDescriptiontorpedosIt should contain the\u00a0totalTorpedos\u00a0loaded.torpedosLaunchedIt should contain the\u00a0torpedosFired.\nMethodDescriptionfireTorpedosWhen this method is called, it should decrease the\u00a0totalTorpedos\u00a0by\u00a0torpedosFired\u00a0and log the number of torpedos fired and left, as shown in the sample outputs.\nThe sequence of operations is, \nSubmerge the Submarine"},{"attributes":{"list":"ordered"},"insert":"\n"},{"insert":"Fire torpedos"},{"attributes":{"list":"ordered"},"insert":"\n"},{"insert":"Surface the Submarine"},{"attributes":{"list":"ordered"},"insert":"\n"},{"insert":"Input"},{"attributes":{"header":4},"insert":"\n"},{"insert":"The first line of input contains a number\u00a0totalTorpedos"},{"attributes":{"list":"bullet"},"insert":"\n"},{"insert":"The second line of input contains a number\u00a0torpedosFired"},{"attributes":{"list":"bullet"},"insert":"\n"},{"insert":"Output"},{"attributes":{"header":4},"insert":"\n"},{"insert":"The first line of output is a string with\u00a0Submarine Submerged\u00a0text"},{"attributes":{"list":"bullet"},"insert":"\n"},{"insert":"The second line of output is a string with the number of torpedos fired and left, as shown in sample outputs"},{"attributes":{"list":"bullet"},"insert":"\n"},{"insert":"The third line of output is a string with\u00a0Submarine Surfaced\u00a0text"},{"attributes":{"list":"bullet"},"insert":"\n"},{"insert":"Sample Input 1\n5\n2\nSample Output 1\nSubmarine Submerged\n2 Torpedos Fired, 3 Left\nSubmarine Surfaced\nSample Input 2\n10\n2\nSample Output 2\nSubmarine Submerged\n2 Torpedos Fired, 8 Left\nSubmarine Surfaced\n\ni want code in between write your code here\n\n\"use strict\";\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding(\"utf-8\");\n\nlet inputString = \"\";\nlet currentLine = 0;\n\nprocess.stdin.on(\"data\", (inputStdin) => {\n\u00a0inputString += inputStdin;\n});\n\nprocess.stdin.on(\"end\", (_) => {\n\u00a0inputString = inputString.trim().split(\"\\n\").map((str) => str.trim());\n\u00a0main();\n});\n\nfunction readLine() {\n\u00a0return inputString[currentLine++];\n}\n\n\/* Please do not modify anything above this line *\/\n\nclass Submarine {\n\u00a0constructor() {\n\u00a0\u00a0this.isSubmerged = false;\n\u00a0}\n\n\u00a0\/* Write your code here *\/\n}\n\nclass WeaponUnit extends Submarine {\n\u00a0\u00a0\n\u00a0\/* Write your code here *\/\n\n}\n\n\/* Please do not modify anything below this line *\/\n\nfunction main() {\n\u00a0const totalTorpedos = parseInt(readLine());\n\u00a0const torpedosFired = parseInt(readLine());\u00a0\u00a0\n\u00a0\u00a0\n\u00a0const weaponUnit1 = new WeaponUnit(totalTorpedos, torpedosFired);\n\u00a0\u00a0\n\u00a0weaponUnit1.dive();\n\u00a0weaponUnit1.fireTorpedos();\n\u00a0weaponUnit1.surface();\n}\n"}]}
I need basic explanations
Special Requirements
Upload files (if required)
Drop files here to upload
Add files...
Account info
Already have an account?
Create an account
Name
*
E-mail
*
Password
*
The password must be at least 6 characters.
I agree with
terms & conditions
Create account & Place an order
Please fix the following input errors:
dummy