Question

JavaScript - Build with Node.js Follow the instructions bellow for a good rate Create a program...

JavaScript - Build with Node.js
Follow the instructions bellow for a good rate

Create a program that will add, remove, get and display all items, stored in JSON file, based on user input (i.e. using yargs). You should choose your own individual purpose - it can be a warehouse, ticketing system, grading book, etc. Make sure you create an appropriate JSON object with real-life parameters - for example for user registration system you should use id, email, and a name.

Make sure the program works, show the console output using a text editor (i.e. Sublime)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

PROGRAM:

//test.js

//I have run this code in chrome browser

//defined the empty json object

  

var jsonObject =

{

};

//asking user for json object description that what kinf of info

  

//going to store

  

var description = prompt ("Enter the description for json object")

//adding to json object

  

jsonObject.description = description;

//using while for menu

  

while (1)

{

  

console.

log ("1.Add info\n2.remove info\n3.get info\n4.display all\n5.Exit");

  

//getting the user choice

  

var choice = prompt ("Please enter your selection");

  

//adding the new property in json object

  

if (choice == = '1')

{

console.log ("add property");

var key = prompt ("Enter the key ");

var value = prompt ("ENter the value ");

console.log ("key = " + key)

jsonObject[key] = value;

  

}

  

//getting the key for removing

  

else if (choice == = '2')

{

var key = prompt ("ENter the key for removing");

delete jsonObject[key];

  

}

  

//getting the value by providing the key

  

else if (choice == = '3')

{

var key = prompt ("ENter the key for get value");

console.log (jsonObject[key]);

  

}

  

//printing the json object

  

else if (choice == = '4')

{

console.log (JSON.stringify (jsonObject));

  

}

  

//exitting the menu

  

else if (choice == = '5')

{

break;

  

}

  

//in case of not valid input

  

else

{

console.log ("try again!");

  

}

  

}

//OUT

1.Add info 2. remove info 3.get info 4.display all 5.Exit add VM366:5 VM366 10 VM366:14 keyuserId 1.Add info 2. remove info 3.get info 4.display all 5.Exit add VM366 10 VM366:14 VM366:5 keyuserName 1.Add info 2. remove info 3.get info 4.display all 5.Exit description:user registration, userId: A123, userName:Rakesh 1.Add info 2. remove info 3.get info 4.display all 5.Exit VM366:5 A123 1.Add info 2. remove info 3.get info 4.display all 5.Exit add VM366:5 VM366:10 keyuserEmail VM366:14

Add a comment
Know the answer?
Add Answer to:
JavaScript - Build with Node.js Follow the instructions bellow for a good rate Create a program...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JavaScript Just use javascript, dont include HTML Follow the instructions bellow for a good rate Create...

    JavaScript Just use javascript, dont include HTML Follow the instructions bellow for a good rate Create a program that will display the result of three functions: a) sum the elements from the Fibonacci sequence b) divide them by randomly generated number c) calculate factorial from the rounded result of previous operation Functions should be stored in one, separate file. The main program should run from the app.js that is provided bellow, the other file should be called module.js that includes...

  • BANK ATM application program in JAVASCRIPT, that allows the user to manage transaction data. like withdraw,deposit,etc....

    BANK ATM application program in JAVASCRIPT, that allows the user to manage transaction data. like withdraw,deposit,etc. Make sure it produces tabular feedback to the user. (meaning user should be able to enter a quanity let's say $20 withdrawal and balance of $100, so it's balance will be $80..As well to deposit money and add the balance to that deposit. Finally to show (-) signs if balance is overdraw,,,Program reads input from the user though the web page., any help is...

  • Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows...

    Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows users to register and login into the system. The focus of this project is for you to create an app with several activities and has data validation. You should have for your app: A welcome screen (splash screen) with your app name and a picture. You should then move to a screen that asks the user for either to log in or to register....

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

  • Design program so that it correctly meets the program specifications given below.   Specifications: Create a menu-driven...

    Design program so that it correctly meets the program specifications given below.   Specifications: Create a menu-driven program that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- square 2 -- circle 3 -- right triangle 4 -- quit If the user selects choice 1, the program should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the user...

  • Write a Java program to read customer details from an input text file corresponding to problem...

    Write a Java program to read customer details from an input text file corresponding to problem under PA07/Q1, Movie Ticketing System The input text file i.e. customers.txt has customer details in the following format: A sample data line is provided below. “John Doe”, 1234, “Movie 1”, 12.99, 1.99, 2.15, 13.99 Customer Name Member ID Movie Name Ticket Cost Total Discount Sales Tax Net Movie Ticket Cost Note: if a customer is non-member, then the corresponding memberID field is empty in...

  • Create the Python code for a program adhering to the following specifications. Write an Employee class...

    Create the Python code for a program adhering to the following specifications. Write an Employee class that keeps data attributes for the following pieces of information: - Employee Name (a string) - Employee Number (a string) Make sure to create all the accessor, mutator, and __str__ methods for the object. Next, write a class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: - Shift number (an integer,...

  • You will create a class to keep student's information: name, student ID, and grade. The program...

    You will create a class to keep student's information: name, student ID, and grade. The program will have the following functionality: - The record is persistent, that is, the whole registry should be saved on file upon exiting the program, and after any major change. - The program should provide the option to create a new entry with a student's name, ID, and grade. - There should be an option to lookup a student from his student ID (this will...

  • Write a Python program to create userids: You work for a small company that keeps the...

    Write a Python program to create userids: You work for a small company that keeps the following information about its clients: • first name • last name • a user code assigned by your company. The information is stored in a file clients.txt with the information for each client on one line (last name first), with commas between the parts. In the clients.txt file is: Jones, Sally,00345 Lin,Nenya,00548 Fule,A,00000 Your job is to create a program assign usernames for a...

  • is due in 2 hours so i had to repost, sorry. Create an application that allows...

    is due in 2 hours so i had to repost, sorry. Create an application that allows you to manage a task list that’s stored in a database. using java and netbeans Console: Task List COMMAND MENU view - View pending tasks history -View completed tasks add -Add a task complete -Complete a task delete -Delete a task exit -Exit program Command: view 1. Buy toothbrush 2. Do homework Command: complete Number: 2 Command: add Description: Pay bills Command: view 1....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT