Write in Java:
Given a long integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.

Ex: If the input is:
8005551212

the output is:
(800) 555-1212

Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72.

Hint: Use / to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 / 100, which yields 5. (Recall integer division discards the fraction).

For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed.

LabProgram.java:

import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
long phoneNumber;
// Add more variables as needed

phoneNumber = scnr.nextLong();

/* Type your code here. */
}
}

Answers

Answer 1

import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {

   Scanner scnr = new Scanner(System.in);

   long phoneNumber;

   phoneNumber = scnr.nextLong();

   long areaCode =  phoneNumber/10000000;

   long prefix = (phoneNumber/10000)%1000;

   long lineNumber = phoneNumber%10000;

   System.out.println("("+areaCode+")"+prefix+"-"+lineNumber);

}

}

I hope this helps!


Related Questions

a document contains a list of items that appear in no particular order. what is the best way to format the list

Answers

Answer:

bulleted list

Explanation:

Bulleted list is the best way to format the list. As a document contains a list of items that appear in no particular order.

What is meant by Bulleted list?

A bullet list is simply a list of items with dotted dots separating each item and a heading at the top. These lists are flexible and may be used for whatever you need them for, from something as informal as an agenda to something as serious as a business strategy for your place of business.

A bullet list is used when making a list of two or more items, where the order of the items is not important. A retailer may display a list of items you want to buy in the form of a bullet list, for example.

Use a number list if you're composing a list of actions or instructions when the order is important.

Thus, it is Bulleted list.

For more details about Bulleted list, click here:

https://brainly.com/question/17359798

#SPJ2

An example of a _________________ impact is when a consumer wants to buy a product on the internet but is afraid the company won’t fulfill their request due to an unsure reputation of that business.

A)Negative


B)Positive

Answers

Answer:

ooof

Explanation:

Answer:

B) negative

Explanation:

the evidence shown "unsure reputation of that business"

You are troubleshooting an issue where a PC can reach some hosts on the Internet (using either DNS name or IP address), while several other hosts on the Internet are not reachable. From the PC you can Ping all devices on your local subnet. What is most likely causing the problem?

Answers

The options are missing from the question,below are the options to choose from;

A) incorrect (or missing) routes in a routers routing table

B) incorrect DNS configuration on the PC

C) incorrect default gateway configuration on the PC

D) duplicate IP addresses on your LAN

Answer: The correct answer to the question is option A

INCORRECT (OR MISSING) ROUTES IN A ROUTERS ROUTING TABLE.

Explanation: When it is possible for a PC to ping some devices but not actually all,we can then make an assumption that either it has a wrong subnet that is configured or the router from the path to the remote device actually has an incorrect or a missing routes to the device.

What is the capacity of a disk with two platters, 10,000 cylinders, an average of 400 sectors per track, and 512 bytes per sector?
What is the use of cache memory? Explain the concepts of cache hit and cache miss.

Answers

Answer:

The capacity of the disk is "40 GB".

Explanation:

Given value:

[tex]\to \text{cylinder}= 10,000\\\\\to \frac{sector}{track} = 400\\\\\to \frac{bytes}{sector} = 512\\[/tex]

[tex]\text{Calculating the size of track} = \frac{bytes}{sector} \times \frac{sector}{track}[/tex]

                                            [tex]= 512 \times 400 \\\\ = 204,800 \ \ Or \ \ 200 \ K[/tex]

[tex]\text{Calculating the size of surface} = \frac{byte}{track} \times \ cylinder[/tex]

                                               [tex]= 2000 \ K \times 10,000 \\\\ = 20, 000,000 \ K[/tex]

[tex]\text{Calculating the capacity of a disk} = \frac{byte}{surface} \times \frac{surface}{disk}[/tex]

                                                     [tex]= 20, 000,000 \ K \times 2 \\\\ = 40, 000,000 \ K \\\\= 40 \ GB[/tex]

Cache memory is often used to speed up the runtime. It will enable us to improve performance unless we can store information, that is retrieved constantly in memory space.

Hit Cache: when the Processor relates to representing database data, Cache Hit results. Miss Cache: when this Processor responds to a non-present cache data, this will trigger its miss of cache.It doesn't have to retrieve the Main Memory through secondary storage.

Which of these is a valid use of the Reply All feature?


correcting someone's spelling mistake in an e-mail


responding with "I agree" or "me too"


responding with "please take me off your list"


none of these

Answers

Answer:

I think is None of this ,

According to the options given none of these is a valid use of the Reply All feature. Thus, option D is correct.

What is the use of  auto-responder?

If you use an auto-responder, all your customers will receive a standardized reply. That will make it clear for them that their message has not been read yet. However, even if your message states that you will eventually read and respond properly to every single email.

It is likely that customers will doubt it. They do not expect an automatic response upon contacting you - quite the contrary, they expect their issues to be addressed specifically and immediately.

An email message is a text that is transmitted or received over a computer network and is often short and casual. Email communications are often only text messages, but they can also contain attachments (such spreadsheets and graphic files). Multiple people can receive an email message at once.

Therefore, According to the options given none of these is a valid use of the Reply All feature. Thus, option D is correct.

Learn more about Email communications on:

https://brainly.com/question/30262540

#SPJ3

_decisions are more common at lower organizational levels

Answers

Which of the following is not a characteristic of a structured decision?

The first three phases of the decision-making process need not occur in any particular sequence.

Structured

________ decisions are more common at lower organizational levels.

Operational control

_____ is the efficient and effective execution of specific tasks.

unstructured

When there is no well-understood or agreed-on procedure for making a decision, the decision is said to be:

Users didn't have the right tools to access the data.

Refer to the Opening Case - Quality Assurance at Daimler AG: Which of the following best describes Daimler's Quality Information System (QUIS)?

digital dashboards

Which of the following information systems are very user friendly, supported by graphics, and provide exception reporting and drill down?

The number of alternatives is decreasing.

Which of the following is not a reason why managers need IT support?

implementation

Success in the _____ phase of the decision-making process results in resolving the original problem, and failure leads to a return to previous phases.

interpersonal

Being a figurehead and leader is part of the _____ managerial role.

Right now I have an i5 2400 and a PYN XLR8 gaming GTX 1650 Super, my CPU is too weak for 1080p gaming, what CPU should I get that has a B75 LGA 1155 socket, or Overclock it if so how many GHz should I overclock it to
(I only have a stock cooler)

Answers

Answer:

if its a number you need 5600GHz but im not to sure

Explanation:

Answer:

answer

Explanation:

if it a number you need 5600GHz but it not I'm not sure

Q1 To remove filter

Option1: Click the Filter option of the Sort & Filter button in the Editing group on the HOME

Option2: Click the Filter option in the Sort & Filter group on the DATA tab.

Option3: Both 1 and 2

Option4: Pres DELETE​​

Answers

Answer:

Click DATA, Look for "Sort & Filter", Click Filter Box (right above "Sort & Filter"). Done.

Answer:

add a picture pls

Explanation:

which is the best software application to be used by a hotel manager​

Answers

Answer:

Cloudbeds

:))

hope it helps

a good look of a web page depends upon?​

Answers

Answer:

Depends mostly on your opinion

Help I’ll mark you brainly!

Answers

1. shapes

2. Shapes are classified and have a certain look. Forms are mostly organic and don't have a specific form.

3. value and depth

4. yellow, blue, red

5. orange, green, purple

6. opposite each other

7. right next to each other

9. tint-lightness  shade - darkness

10. value

Have a great day!

~PumpkinSpice1

P.S.~ I take Digital arts so I know all the answers :) I just finished my color unit.

Just took a test and I got 5 wrong and I wanted to know the correct answers

Answers

Answer:

I need the pic

Explanation:

The single-cycle datapath conceptually described in this section must have separate instruction and data memories, because:________. a. the formats of data and instructions are diff erent in MIPS, and hence different memories are needed. b. having separate memories is less expensive. c. the processor operates in one cycle and cannot use a single-ported memory for two different accesses within that cycled. the formats of data and instructions are different in MIPS, and hence different R-type instructions are needed .

Answers

Answer:

C. The processor operates in one cycle and cannot use a single-ported memory for two different accesses within that cycle

Explanation:

Processors require instructions and data which are retrieved from data memories for processing, but it cannot access two or receive two both processes as only a port is used for accessing data and another for receiving instructions. In fact, a single-cycle or single-clock processor cannot use a resource more than once.

which best explains the relationship among these three facts question 8

Answers

Answer:

no attachment

Explanation:

What is the definition of trouble shooting.

Answers

Answer:Trace and correct fault in mechanical or electrical system

What is output?

C = 1
sum - 0
while (c < 10):
c = c + 3
sum = sum + c

print (sum)​

Answers

11

Explanation:

Please make me Brainliest

Why is it useful to have more than one possible path through a network for each pair of stations?

Answers

Answer:

Because if one path is crowded, then there is always another path to make it less crowded and it is more convenient

Explanation:

Which is a conditional statement?
If it is sunny, we can play ball.
It is sunny today.
It is sunny or rainy.
It is sunny across the street, but not sunny here.

Answers

i believe it is “if it is sunny, we can play ball”

Answer:

it is 1, I know this because i got 100% on my quiz

Explanation:

Write a function that will sum all of the numbers in a list, ignoring the non-numbers. The function should takes one parameter: a list of values (value_list) of various types. The recommended approach for this:

a. create a variable to hold the current sum and initialize it to zero.
b. use a for loop to process each element of the list.
c. test each element to see if it is an integer or a float, and, if so, add its value to the current sum.
d. return the sum at the end.

Answers

In python 3.8:

def func(value_list):

   lst = [x for x in value_list if type(x) == int or type(x) == float]

   return sum(lst)

print(func(["h", "w", 32, 342.23, 'j']))

This is one solution using list comprehensions. I prefer this route because the code is concise.

def func(value_list):

   total = 0

   for x in value_list:

       if type(x) == int or type(x) == float:

           total += x

   return total

print(func(["h", "w", 32, 342.23, 'j']))

This is the way as described in your problem.

It is acceptable to create two TCP connections on the same server/port doublet from the same client/port doublet. True False

Answers

Answer:

False

Explanation:

would be blocked from server

write a C++ program that ask the user for the number of cookies eaten and display the calorie consumption

Answers

Answer:

#include <iostream>

using namespace std;

int main()

{

   int cookies;

   cin >> cookies;

   cout << "The calorie consumption is: " << cookies * 142 << endl;

   return 0;

}

Explanation:

First line: include basic library of C++(input and output).

using namespace std;

Says to compiler we are using std.

int main() Main function

int cookies, cookies variable, of int type

cin >> cookies

get the number of the cookies from user

cout Print the text and calories(one cookie have 142 calories)

Have a nice day ;)

In order to make schemas that will appear in the Schema Library available in the XML Options dialog box, what file extension should a user give to schemas?

--.xml
--.xsl
--.xslt
--.xsd

Answers

Answer:

You can use your XML parser

Explanation:

hope this helps!

Looking at the response vehicles (pictured above), explain two options you have in order to abide by the Move Over law,

Answers

Answer: two options I have in order to abide by the move over law is to either move over or slow down. You must move over a lane away from stationary emergency vehicles if it is safe to do so. If it is not safe to do so then the driver must proceed with due caution, with a safe speed for road conditions.Until the driver has passed the emergency vehicle.

Explanation:Let me know if this helped! (:

Answer:

two possible options in order to abide by the move over law would be to either move over to a different lane (one lane away or more) or slow down.

Explanation:

PLS HELP IN WHATEVER WAY YOU CAN ASAP
the company's Chief Financial Officer recognizes the need for an upgrade to the smart watches but does not understand why the budget proposed request more than the purchase price of the update software how would you respond to this

Answers

Answer:

what ever way I can you say

I would respond by explaining that the price may go up or down before we buy them and that it is good to have some wiggle room with the cost. I would also mention that any unused money will come right back and that it is just a precaution.

Which of the following is considered an input device?

Answers

Do you have a picture or list?

Answer:

Keyboard

Mouse

Light pen

Microphone

Touch pad

What is the difference between a spreadsheet and word processing software?

Only one can calculate numeric data.
Only one can display graphs and charts.
Only one can organize data.
Only one can present text and numeric data.

Answers

Answer:

Only one can calculate numeric data.

Explanation:

Both spreadsheet and word processing software can display graphs and chats.

Both spreadsheet and word processing software can organize data through cells and tables respectively.

Both spreadsheet and word processing software can present text and numeric data.

Answer:

Only one can calculate numeric data.

Explanation:

Your personal opinion about what a "successful" console in the future will need to include to sell well. How have the changes in technology, gaming culture, and overall society affected the market?

Answers

Answer:

The answer is below

Explanation:

In my personal opinion what a "successful" console in the future will need to include to sell well is "a big library of games." This feature will help a console supports many games that will appeal to all categories of gamers.

The changes in technology, gaming culture, and overall society has affected the game market in many ways such as:

1. In terms of technology: it has made the game manufacturers both the console and third-party game developers to improve their gaming features. For example, the advancement in gaming pads becoming wireless. The gaming console having internet or online features, where gamers can play with each other around the world from their rooms. Also, the gaming character design looking more and more like the real-life personality it represents.

2. In terms of gaming culture: modern games are no longer for teenagers alone. It is now appealing to adults as well. This is evident in football players and coaches playing the games and talking about it. Even some players tend to influence their ratings in the game by mentioning how good they are in the press in comparison to the rating game developers are giving them.

3. Overall society has now seen gaming consoles as part of everyday life. The parents, researchers, and even feminist groups are now well aware of the gaming industry. And each of the stakeholders involved is influenced by how the game consoles manufacturers market their games through media, sports personalities, celebrities, etc.

Range is an example of a ______________.

Answers

Answer:

example in ( 4,6,9,3,7) lowest value is 3and highest is 9.

I NEED HELPS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! UWU

jeremy has a handful of resisters and all of them except one have for bands the exception has three why?

Answers

Answer:

The 3 band resistor does not specify the tolerance.

Ususally this means the tolerance is 20%, which is not great.

Explanation:

The last band is typically the tolerance band, i.e., the lower the tolerance the more accurate the value as indicated by the other bands. In case of a 3 band code, there is no tolerance specified and you have to assume the default of 20%.

I have put the question in twice and I cannot get a answer for it .. this site isn’t great in my view..

Answers

which site? Maybe try to turn off your device and turn it on again then go back to the website
Other Questions
Match the function below with its corresponding graph or value Is still popular belief in monkey's paw? A recent study investigated whether renowned violinists were able to classify the age of a violin. In the study, violins constructed before 1900 and violins constructed after 2010 were used. The violinists played each violin and were asked to classify the violin as old (constructed before 1900) or new (constructed after 2010). The responses are shown in the following table.Which of the following statements is supported by the results in the table?1.)The proportion of all new violins that are correctly classified is equal to the proportion of all old violins that are correctly classified.2.)The proportion of all new violins that are incorrectly classified is equal to the proportion of all old violins that are correctly classified.3.)The proportion of all incorrectly classified violins that are old is equal to the proportion of all correctly classified violins that are new.4.)The proportion of all incorrectly classified violins that are new is equal to the proportion of all correctly classified violins that are new.5.)The proportion of all correctly classified violins that are old is equal to the proportion of all new violins that are incorrectly classified. ms kim borrowed 1350 to buy to used a automobile if she repays 75 a month how many months will it take ro pay back the loan 4) On Monday Elaine ran 5 miles and 3 laps around a trail. On Tuesday she ran 6 miles and 2 laps around a trail. She ran the same distance both days. How many miles long is one lap around the trail? The resistance in a particular kind of circuit is found using this formula: R1(R2)R1+R2.Assuming all the variables are non-zero, which line of code will find the value of the resistance? resistance = (R1 * R2) / (R1 + R2)resistance = R1(R2) / R1 + R2 resistance = R1(R2) / (R1 + R2)resistance = R1(R2) / (R1 + R2) Solve four and six eighths minus two and three fifths.(GIVING EXTRA POINTS AND GIVING BRAINLIEST!!)A) one and six thirteenthsB) one and three fortiethsC) two and six fortiethsD) two and three thirteens(Here is an image if needed) : DONT HAVE MUCH TIME LEFT, THIS WILL BE DUE SOON!!!What is the slope?Simplify your answer and write it as a proper fraction, improper fraction, or integer. PLEASE HELP, WILL GIVE BRAINLIESTRead this part from the selection. The author's phrase "the most fundamental of freedoms" is a persuasive device best described as A.) kairos. .) pathos. C.) prognostication D.) parallelism. how do unicellular and multicellular organisms differ? Ariana, Boris, Cecile, and Diego are students in the service club. Three of the four students will be chosen to attend a conference. Which choice represents the sample space, S, for this event? .... is an example of what extrusive rock. *gabbrobasaltGranitediamond Uhhh pls help. I know that A is not it. Can someone please help me with this and show work as well What is the value of the expression below?8 *divide* 2 + 6x5 What is often called the "Second War of Independence? the War of 1812the Napoleonic Warsthe Battle of Baltimorethe Battle of New Orleans What is the value of the 11th term in the sequence -3, -6, -12, -24, ...?A. -6,144B. -118,098C. -3,072D. -354,294 Popular culture creates tension between less developed and developed countries as many less developed countries fear the loss of their walk traditions due to A they want to avoid political disputes B western (developed countries) perspective may become more dominate C western (developed countries) clothing styles are less comfortable D popular culture devalues women E they do not want to preserve traditional values What is the equation of the line that passes through the point (-1,7) and has a slope of -2? Can you name the scene where Romeo listens to Juliet talk about him on her balcony?