Write a javascript program do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user whether he or she wishes to perform the operation again. If so, the loop should repeat; otherwise it should terminate
SERIES OF OPERATIONS
myArray of numbers, write a JS program to perform the following steps and log the result.
Multiply each value with 9.
Subtract 20 from each value.
Multiply each value with 7.
Log the values of the resulting array separated by a space.
Input
The input will be a single line containing an array myArray
Output
The output should be a single line with values separated by a space
Constraints
Each value in the array must be a number
Sample Input
[ 12, 2, 2, 4, 1 ]
Sample Output
616 -14 -14 112 -77
Given two boolean values
isGrassTrimmerFound and isWaterHosePipeFound as inputs, create three JS promises using async/await and try/catch blocks.
Input
The first line of input contains a boolean isGrassTrimmerFound
The second line of input contains a boolean isWaterHosePipeFound
Sample Input 1
true
true
Sample Output 1
Grass Trimmed
Garden Cleaned
Watered Plants
Sample Input 2
true
false
Sample Output 2
Grass Trimmed
Garden Cleaned
Water Hose Pipe Not Found
"use strict";
/* Please do not modify anything above this line */
function main() {
const isGrassTrimmerFound = JSON.parse(readLine());
const isWaterHosePipeFound = JSON.parse(readLine());
/* Write code */
const myPromise = async () => {
try {
/* Write code */
} catch(error) {
/* Write code */
}
};
myPromise();
}
InstructionsPerform the following items. Mobile users may write their answers on a clean sheet of paper. (8 items x 5 points)
Hi, I am developing a judging system for the upcoming beauty pageant at school. I am using Visual Studio Code editor, with a firebase framework. I'm also using HTML, Javascript. And I'm using Cloud Firebase database, the free trial. My question is how do I create a system that will allow users to enter multiple scores for one contestant but assume that there will be at least one score entered and average is calculated for each contestant. The scores must be submitted to the database and determine the winner with the highest score and the top 3. Please help me and submit answer to my Email plz.
Final Value with Appreciation
Given principal amount
principal as an input, time period in years time and appreciation percentage apprPercentage as optional inputs, write a JS function to return the final value finalValue with the given appreciation percentage and time period. The default values for time and apprPercentage are 2 and 5 respectively.
Quick Tip
The formula to calculate the final value with appreciation is,
finalValue = principal * (1 + time * appreciation / 100)
Input
The first line of input contains a number principal
The second line (optional) of input contains a number time
The third line (optional) of input contains a number apprPercentage
Output
The output should be a single line containing the finalValue
Sample Input 1
1000
2
3
Sample Output 1
1060
Sample Input 2
3000
Sample Output 2
3300.0000000000005
Search Item in a Mart
Given an array
mart of objects in the prefilled code and categoryOfItem, item as inputs, create a JS promise, resolve with "Item Found" text, if the
categoryOfItem matches with the category and the corresponding items list includes the itemreject with "Category Not Found" text, if the
categoryOfItem does not match with any catergory in the martreject with "Item Not Found" text, if the
items list does not include item Use async/await and try/catch blocks.
Quick Tip
You can use array methods find() and includes().
Input
The first line of input contains a string categoryOfItem
The second line of input contains a number item
Output
The output should be a single line string with the appropriate message
Sample Input 1
pulses
green gram
Sample Output 1
Item Found
Sample Input 2
detergents
tide
Sample Output 2
Category Not Found
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