Book Search
In this assignment, let's build a Book Search page by applying the concepts we learned till now.
Refer to the below image.
Instructions:
sir plz provide the code for this program
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)
Sample Input 1
JavaScript
S
Sample Output 1
Script
Sample Input 2
Language
air
Sample Output 2
Language
"use strict";
function readLine() {
return inputString[currentLine++];
}
function main() {
let inputString = readLine();
const subString = readLine();
/* Write your code here */
console.log(subString.substr(inputString.substr(subString)));
}
Fare per Kilometer
Given total fare
fare and distance travelled in kilometers distance for a rental bike, write a JS constructor function with a method to calculate the fare per kilometer.
Quick Tip
The formula to calculate the fare per kilometer is,
fare per kilometer = fare / distance
The first line of input contains a number
The output should be a single line containing the fare per kilometer
Update Pickup Point
Given a previous pickup point in the prefilled code, and updated pickup point
Update Pickup Point
Given a previous pickup point in the prefilled code, and updated pickup point
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
sir plz provide the code for this program
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().
Sample Input 1
pulses
green gram
Sample Output 1
Item Found
Sample Input 2
detergents
tide
Sample Output 2
Category Not Found
sir plz provide the code for this progarm
Unite Family
Given three objects
Sample Input 1
{'surname' : 'Jones', 'city': 'Los Angeles'}
{'dish': 'puddings'}
{'pet': 'Peter'}
Sample Output 1
Mr and Mrs Jones went to a picnic in Los Angeles with a boy and a pet Peter. Mrs Jones made a special dish "puddings"
Sample Input 2
{'surname' : 'Williams', 'city': 'Columbia'}
{'dish': 'cakes'}
{'pet': 'Rocky'}
Sample Output 2
Mr and Mrs Williams went to a picnic in Columbia with a boy and a pet Rocky. Mrs Williams made a special dish "cakes"
how it is possible these two out puts in console.log
Series of Operations
Given an array
plz provide the code of this program
Given two boolean values
isGrassTrimmerFound and isWaterHosePipeFound as inputs, create three JS promises using async/await and try/catch blocks.
For cutting the grass,
resolve with "Grass Trimmed" text, if the isGrassTrimmerFound is true
reject with "Grass Trimmer Not Found" text, if the isGrassTrimmerFound is false
For cleaning the garden,
resolve with "Garden Cleaned" text
For watering the plants,
resolve with "Watered Plants" text, if the isWaterHosePipeFound is true
reject with "Water Hose Pipe Not Found" text, if the isWaterHosePipeFound is false
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