"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() {
let input = inputString[currentLine++];
return input === undefined ? undefined : JSON.parse(input);
}
/* Please do not modify anything above this line */
/* Write your code here */
/* Please do not modify anything below this line */
function main() {
const principal = readLine();
const time = readLine();
const apprPercentage = readLine();
const finalValue = calculateFinalValueWithAppreciation(principal, time, apprPercentage);
console.log(finalValue);
}
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)
Sample Input 1
1000
2
3
Sample Output 1
1060
Sample Input 2
3000
Sample Output 2
3300.0000000000005
Time Converter
In this assignment, let's build a Time Converter by applying the concepts we learned till now.
Refer to the below image.
https://assets.ccbp.in/frontend/content/dynamic-webapps/time-converter-output.gif
Instructions:
By following the above instructions, achieve the given functionality.
Quick Tip
Note
Use this Background image:
CSS Colors used:
Text colors Hex code values used:
#f5f7fa
#000000
#ffffff
CSS Font families used:
Write a program to control a set of 10 motors; the motors are operating under load balancing mechanism as
follows:
• Motors operate in pairs as follows: 1,10 then 2, 9 then 3,8 then 4,7 then 5,6 then repeat.
• The operating duration for each pair is 10,000 milliseconds.
• After each operating cycle, all motors must be OFF for 10,000 milliseconds then a new cycle starts.
• The operating sequence is running 24/7.
String Starts or Ends with given String
Given an array
stringsArray of strings, and startString, endString as inputs, write a JS program to filter the strings in stringsArray starting with startString or ending with endString.
Quick Tip
You can use the array method filter() and logical operator OR ( || ).
Sample Input 1
['teacher', 'friend', 'cricket', 'farmer', 'rose', 'talent', 'trainer']
t
r
Sample Output 1
[ 'teacher', 'farmer', 'talent', 'trainer' ]
Sample Input 1
['dream', 'player', 'read', 'write', 'trend']
p
d
Sample Output 2
[ 'player', 'read', 'trend' ]
['dreamer', 'player', 'reader', 'writer', 'trendy']
p
er
Expected
[ 'dreamer', 'player', 'reader', 'writer' ]
Your Output
[ 'player' ]
String Slicing
Given two strings
Sample Input 1
JavaScript
S
Sample Output 1
Script
Sample Input 2
Language
air
Sample Output 2
Language
Please help me.
Given product code, name, and price for n=7 products as shown in the code snippet
below.
prod = [11, 22, 32, 44, 55, 66, 77]
name = ['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff', 'ggg'] price = [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7]
Generate a discounted price report given the below discounts:
20% discount if price is more than $400.00
15% discount if price is between $300.00 and $400.00 (both inclusive) 10% discount if price is less than $300.00
Your output should resemble as follows:
Discounted Price List
No. Code Name Price
1 xxx xxx xxx
2 xxx xxx xxx
...
New Price xxx
xxx
Write the definition of void function that takes as input two parameters of type int, double and string.the functions seta the values of int and double variable to 0 and the value of the string variable to the empty string
Solve this Backtracking Question in C++
A two dimensional array of characters can be considered as a field. Each cell is either water 'W' or
a tree 'T'. A forest is a collection of connected trees. Two trees are connected if they share a side
i.e. if they are adjacent to each other. Your task is, given the information about the field, print the
size of the largest forest. Size of a forest is the number of trees in it. See the sample case for clarity;
Sample Input:
5
TTTWW
TWWTT
TWWTT
TWTTT
WWTTT
Sample Output:
10
Speed Typing Test
In this assignment, let's build a Speed Typing Test by applying the concepts we learned till now.
Refer to the below image.
https://assets.ccbp.in/frontend/content/dynamic-webapps/speed-typing-test-output.gif
The Url will show you the required output to be generated.
Instructions:
By following the above instructions, achieve the given functionality.
Clock Image:
CSS Colors Used:
Background Color Hex Codes Used:
#690cb0
#dac0ff
#f3eaff
#f2ebfe
#ffffff
Border Color Hex Codes Used:
#9aa5b1
Text Color Hex Codes Used:
#690cb0
#3e4c59
#ffffff
#323f4b
This is the code for Getting all the channel_ids that uploaded at least one video in "AI/ML" or "Robotics" technologies between 2018 and 2021.
SELECT
DISTINCT channel_id
FROM
video
WHERE
video_id >= 1
AND name LIKE '%AI/ML%'
OR name LIKE '%Robotics%'
AND strftime('%Y', published_datetime) BETWEEN "2018"
AND "2021"
GROUP BY
channel_id
ORDER BY
channel_id ASC;
Output Table:
channel_id
351
353
364
365
377But,
How can I Get all the channel_ids that uploaded at least 20 videos in "AI/ML", "Cyber Security", "Data Science" or "Robotics" technologies between 2018 and 2021.
Example: If a channel publishes 5 videos in AI/ML, 10 videos in Cyber Security and 5 videos in Data Science, consider the channel
the table data is very huge so, I cant send the complete table data.
please help me.