Write a function that receives a key-value pair (for example: 3.5: 40 ) where the key...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a function that receives a key-value pair (for example: 3.5: 40 ) where the key (in this case: 3.5) is the note and the value (in this case: 48) is the percentage of the respective note. The function returns an object with two properties: Hints • Since the notes and percentages are entered in an object, the notes (keys) must all be different. . You can use console.log to debug the output from your solution. Requirements The function accepts an object that cannot be empty. Arrays are not allowed. Keys or values that are null, undefined or empty are not allowed. . accumulated Percentage equal to the sum of all percantages (values) accumulatedNote equal to the sum of products of each note and its corresponding percentage (key-value pairs) Make sure that the input entered is fully correct with the validations needed. . • A key must be a number in the range 10.5] (0<= key <= 5). . A value must be an integer number in the range (0,100] (0< value <= 100). • The total sum of percentage values must be a maximum of 100. • Output is an object that contains accumulated Percentage and accumulatedNote properties. Write a function that receives a key-value pair (for example: 3.5: 40 ) where the key (in this case: 3.5) is the note and the value (in this case: 48) is the percentage of the respective note. The function returns an object with two properties: Hints • Since the notes and percentages are entered in an object, the notes (keys) must all be different. . You can use console.log to debug the output from your solution. Requirements The function accepts an object that cannot be empty. Arrays are not allowed. Keys or values that are null, undefined or empty are not allowed. . accumulated Percentage equal to the sum of all percantages (values) accumulatedNote equal to the sum of products of each note and its corresponding percentage (key-value pairs) Make sure that the input entered is fully correct with the validations needed. . • A key must be a number in the range 10.5] (0<= key <= 5). . A value must be an integer number in the range (0,100] (0< value <= 100). • The total sum of percentage values must be a maximum of 100. • Output is an object that contains accumulated Percentage and accumulatedNote properties.
Expert Answer:
Answer rating: 100% (QA)
function academicNotesnotes if typeof notes object ArrayisArraynotes Objectkeysnoteslength 0 throw n... View the full answer
Related Book For
Discovering Advanced Algebra An Investigative Approach
ISBN: 978-1559539845
1st edition
Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke
Posted Date:
Students also viewed these programming questions
-
MCO Leather manufactures leather purses. Each purse requires 3 pounds of direct materials at a cost of $5 per pound and 0.7 direct labor hour at a rate of $10 per hour. Variable overhead is budgeted...
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
/** * WEB222 - Assignment 02 * * I declare that this assignment is my own work in accordance with * Seneca Academic Policy. No part of this assignment has been * copied manually or electronically...
-
How important it is to educate ourselves environmental issues impacting the future of tourism i.e., climate change The COVID-19 pandemic has changed the tourism industry forever and will impact our...
-
The company in Problem 39 is also planning to manufacture and market a four-slice toaster. For this toaster, the research department's estimates are a weekly demand of 300 toasters at a price of $25...
-
Suppose a production function is given by Q = K + L-that is, the inputs are perfect substitutes. For this production function, MPL = 1 and MPK = 1. Draw a graph of the demand curve for labor when the...
-
On 1 January 20X8, Grabbit plc entered into an agreement to lease a widgeting machine for general use in the business.The agreement, which may not be terminated by either party to it, runs for six...
-
List three types of consulting services that audit firms are now prohibited from providing to clients that are public companies. For each item, indicate the specific threats, if any, that the...
-
Let 1323 3 3 0 13 13 13 121 12 P = 0 be the transition matrix for a Markov chain with three states. Find p D 5/12 7/18 7/18 = 1/3 1/3 2/9 1/4 5/18 7/18 What
-
Jorg is building an office building for Wilmington Company for $20,000,000. The contract has the following characteristics: The office building is built to the customers specifications and the...
-
During the Great Recession of 2008-2009, corporate cash conversion cycles typically increased in length by a significant amount. Why might this have occurred? Was it a good decision by corporate CFOs...
-
Estimate the gravitational force and the acceleration due to gravity on a body of \(1.25 \mathrm{~kg}\) mass on the earth's surface. The radius and mass of the earth are \(6370 \mathrm{~km}\) and...
-
Can the COP of a refrigerator be greater than unity? Why?
-
How do you judge the performance capability of a refrigerator?
-
Describe the 'method of intercept' to determine the partial molar properties of the components in a binary mixture.
-
Explain the dual operation of a heat pump during winter and summer.
-
To pay for a $17,600 camper, Rita made a down payment of $3800 and took out a loan for the rest. On the loan, she paid monthly payments of $247.98 for 5 years. (a) What was the total amount Rita...
-
Orange juice producers are dismayed and puzzled. An economist told them that the reason the demand for orange juice fell is that a new technology allow tomato producers to pick ripe tomatoes more...
-
This data set was collected by a college psychology class to determine the effects of sleep deprivation on students' ability to solve problems. Ten participants went 8, 12, 16, 20, or 24 hours...
-
Use the parametric equations x = - 3t + 1 and y = 2/t + 1 to answer each question. a. Find the x- and y-coordinates of the points that correspond to the values of t = 3, t = 0, and t = - 3. b. Find...
-
Write polar equations to create each graph. For 3b and d, you'll need more than one equation. a. b. c. d. 90 180 270 90 180 0 270 180 152 270 90 180 270P
-
Foreign Exchange Rate Quotations. Define and give an example of the following: a. Bid rate quote b. Ask rate quote
-
Swap Transactions. Define and differentiate the different type of swap transactions in the foreign exchange markets.
-
Foreign Exchange Transaction. Define each of the following types of foreign exchange transactions: a. Spot b. Outright forward c. Forward-forward swaps
Study smarter with the SolutionInn App