Write a recursive function called sumDigits with the following signature: public static long sumDigits(long n) that computes the sum of the digits in a number repeatedly, until the sum is a single digit. For example, if we call sumDigits(123456), the following would result: sumDigits(123456) => 1+2+3+4+5+6 => 21 => 2+1 => 3 so the final answer would be 3. You must meaningfully use recursion for this lab in order to receive any credit. Hint: For this problem it might be useful to convert back and forth between longs and strings. This can be done using the Long.parseLong method and the Long.toString method.

Answers

Answer 1

Here you go:

   public static long sumDigits(long n) {

       if (n < 10) {

           return n; // our exit criterion

       }

       String str = Long.toString(n);

       long sum = 0;

       for(int i=0; i<str.length(); i++) {

           sum += Character.getNumericValue(str.charAt(i));

       }

       return sumDigits(sum);

   }


Related Questions

In 2007, __________ Floridians died in alcohol-related collisions.

A. 501B. 1,051C. 5,015D. 10,839

Answers

It is most likely D. There is no way that A is correct.

Answer:

B. 1,051

Explanation:

A lot of people think that drinking just a little before driving is okay. But the truth is that even in the smallest amount, driving under the influence of alcohol causes a lot of accident out there.

The drink causes a drastic reduction in reflexes, so important in risky traffic situations, in which it is necessary to make quick decisions most of the time. In addition, the alcoholic drink impairs your vision and your balance and your reasoning, and can cause many accidents.

In 2007, for example 1051 Floridians died in alcohol-related collisions.

Naomi wants to search for online courses on web development she types this term in the address bar which browser allows her to use its address bar as a search engine

Answers

Google Chrome browser

Final answer:

Modern web browsers can use the address bar as a search engine. Naomi can use advanced search techniques to narrow down results and find online web development courses.

Explanation:

Naomi is looking for online courses on web development and wishes to use a browser's address bar to search. Modern web browsers such as Chrome, Mozilla Firefox, Microsoft Edge, and Safari, all allow users to perform searches directly from the address bar. Simply typing a search term into the address bar and pressing Enter will invoke the browser's default search engine, which is typically, but can be changed to other search engines like Bing or Yahoo!

Advanced search techniques can be particularly useful in narrowing down search results. For example, using Advanced Search options, she can specify the phrase she's looking for, a particular domain such as .edu for educational resources, and even filter results based on usage rights for materials that can be legally reused. However, it is important to use these options judiciously, as overly restrictive parameters may yield too few results.

When Excel recognizes that you entered a date in mm/dd/yy format, it automatically formats the date as

Answers

mm/dd/yy because it recognized it so i'll do that                                                                        

What kinds of evidence can be used to show that a super continent once existed?

Answers

the continents sort of fit together like a puzzle. if you go to two places that "fit next to each other* in the puzzle but are now separated you will see that they will have the same rocks and fossils present even though they are separated by thousands of miles today

Answer: Fossil Record

Explanation:

Is correct

I'm trying to network two laptops together using ethernet cable but it isn't working. Why isn't it working

Answers

On modern network cards, this should just work.

It is advisable to give each laptop its own fixed IP address, such as 192.168.1.1 and 192.168.1.2 (with a netmask of 255.255.255.0)

However, you need to define what you expect to work. The first thing to try is ping the other machine from the command prompt, e.g.:

C:\> ping 192.168.1.2

Then, you can try to access shared network drives if you have enabled that. In the file explorer, try typing: \\192.168.1.2

True or false: in order to keep yourself and co workers safe, you must be able to recognize electrical hazards

Answers

I believe it’s true

True

In order to keep yourself safe, you need to be able to recognize eletrical hazards.

PLZZZZZZZZZZZZZ HELPPPPPPP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Which of the following are file extensions for presentation files? (Choose all that apply.)
A .ods
B .ppt
C .odp
D .doc

Answers

I would say B and C.

Not A becuz it sounds like a paper, not a presentation.

Not D because the powerpoint is the presenation form of a word doc.


A. .ods is a spreadsheet file format used by OpenOffice/StarOffice, for sharing.

B. .ppt is a powerpoint.

C. .odp is a file extension for a presentation file format.

D. .doc is a word document.


I hope that helps!!! =)

The presentation file extensions among the options are .ppt and .odp, which correspond to earlier versions of Microsoft PowerPoint and ODF Presentation respectively.

Among the options provided for file extensions used for presentation files, the correct choices are:

.ppt
.odp

.ppt is associated with Microsoft PowerPoint, an earlier version being PowerPoint 97-2004, and .odp is the default file format for ODF Presentation, which is used by presentation programs like LibreOffice Impress or OpenOffice Impress.

Option A, .ods, is a file extension for OpenDocument Spreadsheet documents, not for presentations. Option D, .doc, is a file extension for Microsoft Word documents, which are primarily used for text documents.

It is noteworthy that the newer default file format for PowerPoint presentations is .pptx, which is for the Office Open XML format introduced in PowerPoint 2007. However, PowerPoint supports saving files in various formats depending on the audience's needs, including fixed-layout formats like PDF and XPS which are non-editable and suitable for sensitive information.

What High tech scam that uses you email to disclose your credit card numbers, bank account info and social security numbers

Answers

Phishing, also called carding.


Hope this helped :)

If you create and invoke a recursive function without accounting for a base case, what can go wrong?

Answers

Every recursive function should have an exit criterion (=handling the base case) to exit the recursion.

Without it, it wil recurse forever, until system resources run out (typically the call stack will overflow and your program will crash).

19. Julia suffered an injury in January at work to her shoulder. The type of error is this sentence is a/an ___ error.

Answers

I think it’s a punctuation error. Julia suffered an injury, in January, at work to her shoulder. Is how I think it should be written.

In the bee movie whom did barry disappoint by not immediately taking a job in "honey"?

Answers

He disappointed his dad and mom

By not taking a job in honey production and usage, Barry disappointed his parents.

Facts about Barry Was a bee that didn't want to spend his life in the hive. Believed that there was more to life than honey.

As a result Barry refused to take a job in honey like all the other bees and in doing so, disappointed his parents, especially his father who was really looking forward to it.

Find out more about the bee movie at https://brainly.com/question/2278134.

The most popular activities carried out on smartphones is _________. A.Texting B.Watching movies C.E-mailing D.Gaming

Answers

Answer:

Texting

Explanation:

92% of smartphone users are currently texting, 84% of users are net browsing, 76% of users are sending e-mails, 64% of users are playing games, 69% of users are accessing downloaded apps, 59% of users are posting using social networking, and 48% of users are playing multimedia (videos/music).

Furthermore, the correct answer is A.

What is a relationship between a object and a class?

Answers

Hiya!


Of the options given, I would say A. An object is an instance of a class is the correct choice.

Hope this helps!

The commands available from a menu change depending upon what you are doing.
True
False

Answers

This is a true statement

Answer:

TRUE

Explanation:

We want to create a class that represents a geometric sequence. A geometric sequence is a sequence of numbers that begin at some value and then multiplies each value by some constant to get the next value. For example, the geometric sequence 1, 2, 4, 8, 16 starts at 1 and multiplies each term by 2 to get the next. The geometric sequence 10.8, 5.4, 2.7, 1.35 starts at 10.8 and multiplies each term by 0.5 to get the next. The basic framework of a geometric sequence class is below: public class GeometricSequence { private double currentValue; private double multiplier; } Assume that the parameters to the constructor are initial and mult. What should the body of the constructor be?

Answers

You want to initialize your class variables using the constructor, like this:


public GeometricSequence(double initial, double mult)

{

  currentValue = initial;

  multiplier = mult;

}

a category of identity based on membership in a group is called

Answers

A group of selected cells is called a range.

It is called Social Identity.


Your boss calls you from the road she's trying to connect to the local hotel guest wireless network but there's a yellow shield displayed beside that particular wireless selection she's asking you what the shield means what do you tell her

Answers

Hiya!

If there is a yellow shield next to the wireless icon, this indicates that the connection is functioning but is not secured. In this case because she's using the hotel guest wifi, I would tell her to switch to a more secure network or to disregard the error.

Hope this helps!

(Game Design) A function that contains arithmetic symbols ( e.g. +, <, =/) is an operator.

True or False

Answers

True

Because operators are the symbols that show the action.Just like  

2 + 5.

'+' is the operator and 2,5 is the operand.

What is the name of a solid piece of silicon that contains transistors, other components, and their connections?

Answers

Answer:

Integrated Circuit

Explanation:

An Integrated Circuit (IC) is a small microchip that is mostly made of silicon and constitutes hundreds to thousands of tiny electronic components such as transistors and capacitors. ICs are multipurpose and are used as counters, data store, memory, and many more. They are built to support both analog and digital technology. Disassemble a computer, for instance, and you will see ICs pre-built somewhere around a circuitry board.

Final answer:

An integrated circuit, also known as a microchip, is a solid piece of silicon that contains transistors and other electronic components. These microchips are crucial for the functionality of various electronic devices, including computers, due to their semi-conductive properties.

Explanation:

The name of a solid piece of silicon that contains transistors, other components, and their connections is called an integrated circuit, often referred to as a microchip. These integrated circuits are composed of billions of nanoscale transistors and diodes, integral to the functioning of logic and memory functions in devices like computers. Silicon is the most common semiconductor material used in electronic devices, valued for its semi-conductive properties that can be precisely controlled by doping with impurities such as boron or phosphorus.

Furthermore, modern technology such as silicon-CMOS (complementary metal-oxide-semiconductor) relies on these intricate circuits, especially in central processing units (CPUs) of personal computers. The precise manufacturing process of semiconductors, including the use of pure silicon, is critical for creating effective and reliable electronic components.

When installing EMT conduit that will be exposed to wet conditions, _______ fittings should be used.
A. compression
B. threaded
C. indenter
D. set-screw

Answers

When installing EMT conduit that will be exposed to wet conditions, compression fitting should be used.

What is a relationship between a object and a class?

Answers

An object is an instance of a class.

Further Explanation:

Class is an object oriented paradigm that is used to represent real-world objects in OOP. A class is like a blueprint which can be sued to make further instances of the same type. The instances are known as objects. The existence of class is logical while the existence of object is physical as it also takes space in memory. The class is declared only one while the objects can be created as many as are required.

Hence, object is an instance of the class.

Learn more at:

brainly.com/question/9612139brainly.com/question/8839455

#LearnwithBrainly

The valence electron configurations of several atoms are shown. how many bonds can each atom make without hybridization? 2s^2 2p^3

Answers

Answer: This element needs 3 electrons to complete its octet state

Why?:
since the electrons in 2s2 are already paired they cannot form a bond pair with electrons from other elements without hybridisation however the 3 electrons in 2p3 are unpaired so can form bond pairs with electrons from other elements without hybridisation.

Hope this helps!

You want to chart your daily water intake over the next three months. Which type of chart would be best for this purpose? Line Pie Bar Column

Answers

The best type of chart to illustrate the daily water intake that you would be taking in the next three months would be (A) Line.

Line is most suitable because it will show the progression – be it the increase and decrease – of your water intake clearly, compared to using bar, which is more suitable if you would like to contrast your water intake with your soda intake, for example.

Answer:

Did you get what you needed

Explanation:

What is the fundamental goal of outsourcing? increased quality brand expansion cultural diversity cost savings

Answers

Answer:

Cost saving is the fundamental goal of outsourcing.

Explanation:

Initially the companies where outsourcing task only for Cost cutting. But nowadays, the companies do that for so many other reasons like, increase the efficiency, reducing overhead, to concentrate on core business peacefully, to obtain more profit, etc.  

The cultural diversity does not affect or make companies to outsource.

We can indirectly increase the quality but it is not the primary goal of outsourcing.  

Brand expansion will holds good, only the BPO is run under the name of the company. But this is once again not the major objective.

Answer:

The main goal of outsourcing is cost savings

hope this helps :3

A formal written document to establish the process and procedures used to guide a project from inception to conclusion is called a

Answers

That document is called guidance document. Many institutions have guidance documents to set up procedures from the beginning till the end or conclusion of an activity. Those documents could be procedures to get international agreements, procedures to achieve certain standards of quality, etc.

A formal written document to establish the process and procedures used to guide a project from inception to conclusion is called a direction report.

That archive is called direction report. Numerous organizations have direction reports to set up methods from the earliest starting point till the end or finish of a movement. Those archives could be strategies to get worldwide understandings, methods to accomplish certain measures of value, and so on.

Characteristics of a LAN include _____. can be connected to the Internet covers the most area of all networks does not have to be connected to other networks is seldom used by businesses simplest of the networks spans the smallest distance of all networks

Answers

A LAN is a network that spans a small geographical area, can be connected to the Internet, and is widely used by businesses for efficient resource sharing and communication.

Characteristics of a LAN (Local Area Network) include being a network that spans the smallest distance of all networks, typically confined to a single building or campus. It is designed for high-speed data transfer internally, for instance within an organization. A LAN can operate independently but also can be connected to the Internet. Advanced switches in a LAN may support features like Virtual Local Area Networks (VLANs) which provide enhanced security and network management options.

Unlike claims that it covers most areas of all networks or is seldom used by businesses, a LAN is widespread in business environments due to its efficiency in resource sharing and communication within a local setting. The use of a LAN simplifies network management and connectivity, making it far from the simplest of networks due to the potential complexity of its infrastructure which includes switches, Wi-Fi access points, and hubs.

Which telecommunications device is widely used in industries that require closed communication?
A. fixed-line telephones
B. mobile phones.
C. satphones
D. walkie-talkies
E. small phones

Answers

The telecommunications device that  is widely used in industries that require closed communication are walkie-talkies. Correct answer: D

Walkie-talkies are hand-held, portable, two-way radio transceivers which enable secure communication between the two points, without being part of a network.

Answer:

D. walkie-talkies

Explanation:

walkie-talkies are used in industries that require closed communication

My 2 in 1 laptop/tablet

goes black and does this weird glitching thing when i'm in the middle of something

idk why any geeks know?

Answers

"My 2 in 1 laptop/tablet  goes black and does this weird glitching thing..."

2-in-1 has a bunch of connections bet the keyboard n screen. its weaker than a laptop cuz' the keyboard is detachable. bad news if u have a flaky connection there.

if its brand new or under warranty, i wuld send it back. good luck!


Answer: yeah, restart it. :)

Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.Like Earth, Mars has frozen polar caps, but unlike Earth, these caps are made of carbon dioxide ice as well as water ice.

Explanation:

Suppose we want to adjust the page numbering for our Works Cited section so that it starts over at page 1. Is this possible to do in Word?

Answers

I believe if you double click at the top that it will allow you to change it, but if it does not you could always do it on a separate document and then print them.

NUMBER NEW DOCUMENT PROCESS open a new document Press Enter twice to create a space to work on that page immediately insert a new page using section break. Click on the Insert tab click on the Page number option place the pointer over the End of page option Click on the option Number without format 2 This will place the number on the page. a new tab will appear Tools for header and footer check the First page different box This will make the number on page 2 disappear go to page 1 and check the box First page different This will make the number on page 1 disappear NOTE. The section break is only done on the first page, if in another type of document you need to remove the numbering on a page other than 3, for example the Introduction, then repeat the process of inserting a section break until you reach that page. NOTE: The 2 pages will be to make the cover and the cover, for the rest of the document go entering page breaks.

While setting up a home office, a technician disables the DHCP service on the office router, but does not want to rely on link-local addressing

Answers

When the DHCP service is disabled, devices on a network require manual or static IP address assignment using reserved private IP address ranges like 192.168.xxx.xxx, 172.16.xxx.xxx to 172.31.xxx.xxx, and 10.0.xxx.xxx to 10.255.xxx.xxx.

When a technician disables the DHCP service on an office router and does not want to rely on link-local addressing, they are choosing to manually assign IP addresses, or use a static IP address configuration, for all devices on the network. Since the DHCP (Dynamic Host Configuration Protocol) typically provides automatic IP address assignment, its absence means that each device on the network will need a unique IP address manually set to avoid conflicts and ensure connectivity. This can involve configuring each device with an IP address from a range that is reserved for private networks, commonly represented as blocks from 192.168.xxx.xxx, 172.16.xxx.xxx to 172.31.xxx.xxx, and 10.0.xxx.xxx to 10.255.xxx.xxx. These ranges are intended for use within private networks like home or office settings, which are distinct from the public IP addresses assigned to equipment that connects a local network to the Internet.

Other Questions
NEED SOME HELPWhich of the following particulates may be found in a sample of air?A. DustB. PollenC. Volcanic AshD all of the above Newtons first law of motion is sometimes described as _____. the net force law the law of inertia the law of gravity F = ma Elena's aunt bought her a $150 savings bond when she was born. When Alayna is 20 years old the bond will have earned 105% interest how much will the bond be worth when Elena 20 years old? What is ethnocentrism and why were the Chinese ethnocentric? Let f(x)=3x+5 and g(x) =x^2 find g(x)/f(x) and state its domain 1/2 of a box of cereal is divided equally between 4 bowls.How much cereal is in each bowl Please Help! Complete and balance the following equation: Cd(NO3)2 + NH4Cl ((Include explanation please! I cant find how to do it and I need the explanation...)) One safe behavior that the host commends the driver at the end of the video for doing is __________. 8 1/3 x=2 1/3 9.1 please help! The system of equations y = -3x + 5 and y = 3x - 7 hasA. exactly one solution.B. no solution.C. infinitely many solutions.D. exactly two solutions. What ended President William H. Tafts anti-trust efforts?the elimination of monopolies in the U.S.banks' refusal to support dollar diplomacythe end of his term in officehis decision to avoid antagonizing big business how important was religion in ancient india? Name and give examples of at least 7 types of figurative language Which statement is true about the elements present in a pure substance? A They maintain their chemical properties. B They are composed of many compounds. C They can be separated by physical methods. D They can only be separated by chemical methods. There are 230 calories in 4 ounces of a type of ice cream how many calories are in 6 ounces of that type of ice cream how would you present weight change if earth had twice the mass that it does now Anti-Semitism has been a cultural issue since ancient times. The rise of anti-Semitism in Europe prior to and during World War II was a direct cause of which event? A. Holocaust B. invasion of Poland C. Nuremburg Trials D. D-Day invasion E. Cold War Zora Beale Hurston and Langston Hughes were two of the many luminaries that flourished in the (15 points) What are ways the president interacts with foreign countries? Select all that apply.A. He meets with their ambassadors to work out trade agreements.B. He appoints a Secretary of State to institute policy and handle the majority of diplomatic relations.C. He travels to meet with leaders of countries that are on his foreign policy agenda.D. He declares war on them.E. He hosts other state leaders for dinners at the White House. the electric force between two charged objects depends on Steam Workshop Downloader