HTML/JavaScript Web Application Answers

Questions: 588

Answers by our Experts: 588

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

The spread operator is used to:


A. replace an array with individual values

B. assign single values of an array to an variable

C. divide a number by itself

D. accept multiple values sent to a function into a single array


Product of Array Items

given array of integers, write a JS program to get the product of the integers in the given array.Input The input will be a single line containing an array integersOutput:The output should be a single line string containing the product as shown in sample outputs

Testcase1 :Sample Input 1

[1, 2, 3]

Sample Output 1

1 * 2 * 3 = 6

Testcase2 :Sample Input 2

[-1, -2, -3]

Sample Output 2

-1 * -2 * -3 = -6

note : it must satisfy any input given with different cases

"use strict";

process.stdin.resume();

process.stdin.setEncoding("utf-8");

let inputString = "";

let currentLine = 0;

process.stdin.on("data", (inputStdin) => {

 inputString += inputStdin;

});

process.stdin.on("end", (_) => {

 inputString = inputString

  .trim()

  .split("\n")

  .map((str) => str.trim());

 main(); });

function readLine() {

 return inputString[currentLine++]; }

function main() {

 let integers = JSON.parse(readLine());

/* Write your code here



Product of array Items

given an array integers,write JS program to get the product of the integers in the given array.

input

the input will be containing single line integers.

output

the output should be single line containing the product as shown in sample outputs.


input1

[1,2,3]

output1

[1 * 2 * 3 = 6]

input2

[-1, -2, -3]

output2

[-1*-2*-3 = -6]


Note: The Output should be displayed as [1 * 2 * 3 = 6]



Create a link button at the bottom of the webpage that would make it jump to the top of the webpage when clicked

Create a link button at the top of the webpage that would make it jump to the bottom of the webpage when clicked

let's build a Speed Typing Test by using the dynamic concepts of javascript


4. The Litsemba Life Insurance company computes annual policy premiums based on the age the customer turns in the calendar year. The premium is computed by taking the decade of the customer's age, adding 15 to it, and multiplying by 20. Write a Java application that prompts the user for the current year and birth year. Pass both to method that calculates and returns the premium amount and display the returned amount. Application should be saved as Insurance.java . Note: the customer age should not be more than 59 years. [10 Marks]


5. A travelling salesman records his mileage at the end of each week in order to make an accurate claim for expenses.


Write a Java code:

* With a class called Travelling which has a calculateExpenses method which is to prompt the user to input the date and the number of kilometres travelled.

* Perform a validation to ensure that the number of kilometres is an integer greater than 0.


* The method should be written within the same class:

- The first 100 kilometres is paid at R1.20 per kilometre.

- If the of kilometres is more than 100, all additional kilometres are paid at R1.50 per kilometre


* Output:

- The date : 04/28/2022

- The number of kilometres travelled: 200

- The total expenses due : R270.0


4. The Litsemba Group Life Insurance company computes annual policy premiums based on the age the customer turns in the calendar year. The premium is computed by taking the decade of the customer's age, adding 15 to it, and multiplying by 20. For example, a 34 year would pay R360 which is calculated by adding the decades (3) to 15 and multiplying by 20. Write a Java application that prompts a user for the current year and a birth year. Pass both to method that calculates and returns the premium amount and display the returned amount. Application should be named Insurance.java . Note: The customer should not be older than 59 years . [10 Marks]


Create a 500 element array and load the array with a series of numbers starting at the first position that is the square of the index. For example, at position 0 would be 0, at position 1 would be 1, at position 2 would be 4, at position 3 would be 9…. Etc. Ask the user for a number between 0 and 250,000 and let them know if that number is a square. Employ a binary search. 


LATEST TUTORIALS
APPROVED BY CLIENTS