Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE make sure code is in JAVASCRIPT ONLY!!!! USE the following function header ONLY! function deviceNamesSystem(devicenames) { //Write your code here } picture of the

PLEASE make sure code is in JAVASCRIPT ONLY!!!! USE the following function header ONLY!
function deviceNamesSystem(devicenames) {
//Write your code here
}
picture of the questions attached below image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Create unique device names to be used in a residential loT (Internet of Things) system. If a device name already exists in the system, an integer number is added at the end of the name to make it unique. The integer added starts with 1 and is incremented by 1 for each new request of an existing device name. Given a list of device name requests, process all requests and return an array of the corresponding unique device names. Example n = 6 devicenames = ['switch, tv', 'switch', 'tv, 'switch', 'tv'] = devicenames[0] = "switch" is unique. uniqueDevicename[0]="switch" devicenames[1] = "tV' is unique. unique Devicename[1]="t" devicenames[2] = devicenames[0]. Add 1 at the end the previous unique username "switch, Example n = 6 devicenames = ['switch, tv switch', 'ty! switch, "tv' devicenames[0] = "switch" is unique. uniqueDevicename[0]="switch" devicenames[1] = "t" is unique. uniqueDevicename[1]="v" devicenames[2] = devicenames[0]. Add 1 at the end the previous unique username "switch", unique Devicename[2]="switch1" devicenames[3)= devicenames[1]. Add 1 at the end the previous unique username "tv". uniqueDevicename[3]="t1" devicenames[4] =devicenames[2]. Increment by 1 the number at the end of the previous unique username "switch1", unique Devicenames[4="switch2" devicenames[5] = devicenames[3). Increment by 1 the number at the end of the previous unique username "tv1", unique Devicenames[5]="tV2" Karalian warna aiah devicenames[5] devicenames[3]. Increment by 1 the number at the end of the previous unique username "tv1" uniqueDevicenames[5]="tV2" return uniqueDevicenames = ['switch, tv switch 1: 'tvl 'switch2', 'tv2] Function Description Complete the function deviceNames System in the editor below. deviceNamesSystem has the following parameter(s): string devicenames[n]: an array of device name strings in the order requested. Returns string[n], an array of string usernames in the order assigned Constraints 1sns 104 1 s length of devicenames[i] s 20 deviceNamesSystem has the following parameter(s): string devicenames[n]: an array of device name strings in the order requested. Returns stringn): an array of string usernames in the order assigned Constraints 1sns 104 1 s length of devicenames[i]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions