1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Zepler [3.9K]
3 years ago
11

Write a program that inserts parentheses, a space, and a dash into a string of 10 user-entered numbers to format it as a phone n

umber. For example, 5153458912 becomes (515) 345-8912. If the user does not enter exactly 10 digits, display an error message. Continue to accept user input until the user enters 999.
Computers and Technology
1 answer:
Elodia [21]3 years ago
6 0

Answer:

const readline = require('readline-sync');

let reg = /^(\d{3})(\d{3})(\d{4})$/;

 

do {

let number = readline.question("Enter a phone number: ");

 

if (number === '999') {

 process.exit();

}

 

var r = number.match(reg);

if (!r) console.log("That is not right.");

else {

 console.log(`(${r[1]}) ${r[2]}-${r[3]}`);

}

} while (true);

Explanation:

This is a javascript solution using regular expressions.

You might be interested in
How can investors receive compounding returns
ANTONII [103]
If you’ve ever had a savings account, you likely know that a few cents in interest every month barely adds up. The goal is “compounding returns,” which simply means that the interest you earn each month earns additional interest, which then earns even more interest. But although a savings account will help with that, you may be lucky enough to be able to afford a cup of coffee every 10 years or so at that rate. Instead, it’s important to find a way to invest your money in a high-interest account that will earn compounding returns.

I hope this helps you out ;)
3 0
4 years ago
Drag each tile to the correct box.
vekshin1

Answer:

1. Spreadsheet software.

2. Word processor.

3. Database software.

4. Multimedia software.

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer on how to perform a specific task and solve a particular problem.

Simply stated, it's a computer program or application that comprises of sets of code for performing specific tasks on the system.

Basically, the various type of softwares used on computers to perform specific functions include the following;

1. <u>Spreadsheet software</u>: it can be used to create tables with embedded calculations. A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer systems.

2. <u>Word processor</u>: it can be used to format or edit .doc files. Some examples of word processors are Notepad, Microsoft Word, Sublime text, etc.

3. <u>Database software</u>: it can be used to store data in ordered form. Thus, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security. These records are stored and communicated to other data user when required or needed.

4. <u>Multimedia software</u>: it can play .mpg and .mp3 files. A multimedia software refers to a software that is designed and developed to accept, utilize and combine various file formats such as audio, video, text, animation effects, etc.

7 0
3 years ago
) Write the JS code to load the 3rd party script before ready event triggers and after successful load show your name on the bro
Vlad1618 [11]

Answer:

Following are the code to this question:

var id= document.createElement('script');//defining id varaible that uses the createElement method  

ld.src = "https://code.jquery.com/jquery-3.5.1.min.js";//defining id varaible with src that holds the source link

alert("The loaded Script is: ");//defining alert box that print Script loaded.

Explanation:

In the above-given code, an id variable is defined that uses the createElement method, which helps to create the specified name with the Element Node, and in the next line, it uses the src with the id variable, that store the link, it also helps to loads the 3rd party script, which is displayed in an alert msg box.

8 0
4 years ago
The Receiver recognizes the sounds the Sender is making and transforms them into words and ideas in his own mind. What is this
pishuonlain [190]

Answer:

Decoding is the technique used to convert an electrical signal into an understandable message. This process is used in receiver side.

Explanation:

In telecommunication, Decoder is used to to interpret the message sent by transmitter in to an understandable message. This process is called decoding

5 0
3 years ago
Write an HTML document which contains two text fields, a button, and a div. The first text field should be labeled “Temperature”
disa [49]

Answer:

I created a jsfiddle for this: https://jsfiddle.net/tonb/o7uv4cdm/26/

Explanation:

see jsfiddle.

The usual html and body tags are omitted for simplicity. For your stand-alone page you'll have to put them in, as well as additional tags for your inline scripting.

5 0
4 years ago
Other questions:
  • What does ADSL stand for?
    6·2 answers
  • pWhat macOS system application tracks each block on a volume to determine which blocks are in use and which ones are available t
    14·1 answer
  • An _____ is a set of directions for carrying out a task.
    14·1 answer
  • Which of the following statements about functional programming languages is incorrect?A) In pure functional programming, there a
    5·1 answer
  • Player casts 'Assassinate' on 'Acolyte of pain'. Acolyte's owner will:
    6·2 answers
  • Describe the three essential characteristics of an object fromthe perspective of object oriented paradigm.
    7·1 answer
  • Which function in spreadsheet software can be used to predict future sales or inventory needs?
    5·2 answers
  • A penetration tester is experimenting with Network Mapper (Nmap) on a test network as a privileged user. The tester would like t
    11·1 answer
  • What is the difference between the shares Folder and Sessions Folder in the Shared Folders tool?
    12·1 answer
  • A department store maintains data on customers, products, and purchase records in three tables: customer, product, and purchase.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!