Submarine
Given two numbers
totalTorpedos, torpedosFired as inputs, write a super class Submarine with property and methods as below,PropertyDescriptionisSubmergedIt should contain a boolean value to indicate whether the submarine is submerged or not.....
The sequence of operations is,
Sample Input 1
5
2
Sample Output 1
Submarine Submerged
2 Torpedos Fired, 3 Left
Submarine Surfaced
Sample Input 2
10
2
Sample Output 2
Submarine Submerged
2 Torpedos Fired, 8 Left
Submarine Surfaced
Area and Circumference of a Circle
Given radius
radius of a circle, write a JS constructor function with the methods getArea and getCircumference to calculate the area and circumference of the circle.
Note
The value of π = 3.14
Quick Tip
Use the formulae to calculate,
Area of circle = π * radius * radius
Circumference of circle = 2 * π * radius
Input
The input will be a single line containing a number radius
Output
The first line of output should contain the area of the circle
The second line of output should contain the circumference of the circle
Sample Input 1
7
Sample Output 1
153.86
43.96
Sample Input 2
25
Sample Output 2
1962.5
157
totalTorpedos, torpedosFired as inputs, write a super class Submarine with property and methods as below,PropertyDescriptionisSubmergedIt should contain a boolean value to indicate whether the submarine is submerged or not.
MethodDescriptiondiveWhen this method is called, it should set the value of isSubmerged to true and log "Submarine Submerged" text in the console.surfaceWhen this method is called, it should set the value of isSubmerged to false and log "Submarine Surfaced" text in the console.
Add a sub class weaponUnit which extends to Submarine with the below properties and methods,
The sequence of operations is,
Submerge the Submarine
Fire torpedos
Surface the Submarine
Sample Input 1
5
2
Sample Output 1
Submarine Submerged
2 Torpedos Fired, 3 Left
Submarine Surfaced
Sample Input 2
10
2
Sample Output 2
Submarine Submerged
2 Torpedos Fired, 8 Left
Submarine Surfaced
Square at Alternate Indices
Sample Input 1
[ 1, 2, 3, 4, 5 ]
Sample Output 1
[ 1, 2, 9, 4, 25 ]
Sample Input 2
[ 2, 4 ]
Sample Output 2
[ 4, 4 ]
String Slicing: Given two strings inputString and subString as inputs, write a JS program to slice the inputString if it includes the subString. Slice the inputString starting from the subString to the end of the inputString.
Input
The first line of input contains a string inputString
The second line of input contains a string subString
Output
The output should be a sliced string or inputString (if the inputString does not include the subString)
function main() {
let inputString = readLine();
const subString = readLine();
/* Write your code here */
}
i want code in between write code here
Write a JavaScript Program (Using a single HTML and JavaScript file)
to input 2 numbers and determine (using a <p> tag whether:
a. The 2 numbers are equal
b. The first is greater then the second.
c. The second is greater than the first.
Display the message on change of any of the 2 inputs.
Input the Taxable Income and Compute the income tax using the following table:
*Note: Do not use prompts for user inputs. Use the HTML input tag.
over -----------------------------but not over --------------------------------Rate
--- -----------------------------------250,000 ------------------------------------0%
250,000 ---------------------------400,000 ---------------------20% of the excess over 250,000
400,000----------------------------800,000------------- 30,000+25% of the excess over 400,000
800,000------------------------ 2,000,000 ------------130,000+30% of the excess over 800,000
2,000,000 ----------------------8,000,000 -----------490,000+32% of the excess over 2,000,000
8,000,000 ------------------------------------------2,410,000+35% of the excess over 8,000,000
Ex)
Taxable Income Income Tax
180,000 0
320,000 14,000
520,000 60,000
930,000 169,000
2,400,000 618,000
10,000,000 3,110,000
6. Write a program that asks the user for two numbers, then lets the user choose the using 4
buttons, one for each operation. (+, -, *, / )The program should do the requested operation and
display the answer on the screen.
7. Modify program 6 to do the same thing using a dropdown menu and an = button to execute.
Use <select> <option></option></select> for your dropdown. Only java plz
Write a program that asks the user for two numbers, then lets the user choose the using 4
buttons, one for each operation. (+, -, *, / )The program should do the requested operation and
display the answer on the screen. Only Java plz
Write a Javascript Program to Add,Delete employees in a payroll list.
1. The payroll program should input the following:
Employee Name Days Worked Daily Rate Deduction Amount
2. During Addition, the program should display the following in a table:
No. Employee Name Days Worked Daily Rate Gross Pay Deduction Amount Net Pay
where:
No. = is the Payroll List Line number
Gross Pay = Days Worked * Daily Rate
Net Pay = Gross Pay - Deduction Amount
3. During Deletion, the program should ask for the Line Number to delete and update the table