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 item
reject with "Category Not Found" text, if the
categoryOfItem does not match with any catergory in the mart
reject 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
Sample Input 1
pulses
green gram
Sample Output 1
Item Found
function main() {
const categoryOfItem = readLine();
const item = readLine();
const mart = [
{
category:"pulses",
items: ["green gram", "green peas", "Turkish gram"]
},
}
Write a java program that will satisfy the given requirements:
A. It will display the given menu:
A - Arithmetic Series
B - Geometric Series
C - Harmonic Mean
D - Largest Prime Number
E - Largest Prime Number
Q - Quit the Program
B. The program will ask the user his/her choice.
C. If the choice is A,B,C,D or E, It will prompt the user for the required inputs, then compute and display the required outputs. If the choice is Q, the program will terminate
D. Validate all your inputs by promptingg for a new value if input is invalid.
E. Display also a description of your program
F. Program should execute for as long as the user wants to continue
G. Use of arrays is not allowed
Write an if/else statement that compares sold_yesterday and sold_today, and based upon that comparison assigns sales_trend the value -1 (the case where sold_yesterday is greater than sold_today) or 1.
Explain queue with the help of an example.
Write an algorithm/program to push an element in array implemented stack
Explain stacks with the help of an example
//Add a function in the event listener that post the LATlng to a python file
function initMap() {
const myLatlng = { lat: -33., lng: 18 };
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
center: myLatlng,
});
// Create the initial InfoWindow.
let infoWindow = new google.maps.InfoWindow({
content: "Click the map to get Lat/Lng!",
position: myLatlng,
});
infoWindow.open(map);
// Configure the click listener.
map.addListener("click", (mapsMouseEvent) => {
// Close the current InfoWindow.
infoWindow.close();
// Create a new InfoWindow.
infoWindow = new google.maps.InfoWindow({
position: mapsMouseEvent.latLng,
});
infoWindow.setContent(
JSON.stringify(mapsMouseEvent.latLng.toJSON(), null, 2)
);
infoWindow.open(map);
});
}
write a simple program in c++ to calculate the salary of an employee where by the basic salary will be entered by the user and other allowance as constant.
The following are the other allowance
1. dressing allowance 30% of basic
2. Fuel allowance 20% of basic
3. Maintenance allowance 30% of basic
4. SSNIT allowance 10% of basic
5. Rent allowance 40% of basic
Calculate your gross salary