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
oee [108]
4 years ago
13

Write the definition of a method named add that receives a reference to a Scanner object associated with a stream of input consi

sting of integers only. The method reads all the integers remaining to be read from the stream and returns their sum. So if the input were 3 51 204 17 1040 the returned value would be 1315
The method must not use a loop of any kind (for, while, do-while) to accomplish its job.
Computers and Technology
1 answer:
Lisa [10]4 years ago
5 0

Answer:

import java.util.*;

class Main  

{

   public static void main(String[] args)

   {

       System.out.println("Enter integers and 0 to exit");

       Scanner a1=new Scanner(System.in);

       System.out.println(add(a1));

       

   }

  public static int add(Scanner a1)

  {

        int total = a1.nextInt();

          if (a1.hasNextInt())

              {

                 total =total +add(a1);

              }

       return total;

   }

}

Explanation:

The only thing that needs explanation here is hasnextInt. This returns true if entered number is integer and false if entered is not an integer. And rest is as shown in the program.

You might be interested in
"identify three data types covered in the database programming with sql course."
ankoles [38]

I guess the correct answer is VARCHAR, DATE, CHAR

VARCHAR - Hοlds a variablе lеngth string (can cοntain lеttеrs, numbеrs, and spеcial charactеrs). Thе maximum sizе is spеcifiеd in parеnthеsis. Can stοrе up tο 255 charactеrs.

DATE - A datе. Fοrmat: YYYY-MM-DD

CHAR - Hοlds a fixеd lеngth string (can cοntain lеttеrs, numbеrs, and spеcial charactеrs). Thе fixеd sizе is spеcifiеd in parеnthеsis. Can stοrе up tο 255 charactеrs

6 0
3 years ago
Write a program that asks the user for a CSV of the NYC Open Data Film Permits: There is a sample file for June 2019 film permit
Westkost [7]

Answer:

Before running this program, make sure you have installed pandas module for python.

pip install pandas

import pandas as pd

import numpy as np

csv_file = input("Enter CSV File Name : ")

df = pd.read_csv(csv_file)

count_row = df.shape[0]

print("There were %d Film Permits in Total." %(count_row))

borough_count = df['Borough'].value_counts()

print(borough_count)

location_count = df['ParkingHeld'].value_counts().head(5)

print(location_count)

Explanation:

4 0
3 years ago
Read 2 more answers
In setting up a small office network, the network administrator decides to assign private IP addresses dynamically to workstatio
dezoksy [38]

Answer:

It is the DHCP server, or the Dynamic host configuration protocol. And it is responsible for assigning dynamic IP Addresses, It also does the  configuration of database the subnet mask, default gateway, and the dns server. It is by default disabled. And we need to enable it. And hence the answer is the DHCP server, that we need to enable on the router, for ensuring that the office devices are able to access the internet.

Explanation:

The answer is self explanatory.

7 0
3 years ago
1. While cell phones provide Freedom and mobility,they can also become a leash, compelling user's to answer them anywhere and an
____ [38]
Cellular phones have had a major impact on our lives and the way that we perform every day tasks. Many of these changes are apparent, while others we may not even be aware of.

Cell phones have brought a whole new meaning to the term multitasking. Twenty years ago, it was not possible to talk to the office while you were at the grocery store picking up some necessary items. You could never have had a three-way business conference while you were fixing dinner or been able to deal with a business client from home while caring for a sick child.
3 0
3 years ago
A cloud service provider uses the Internet to deliver a computing environment for developing, running, and managing software app
MakcuM [25]

The answer is PaaS (Platform as a Service)  

PaaS provides users with a cloud runtime environment in which they can develop, test, manage, and deliver applications. Users are able to use a suite of pre-built tools to develop and test their own apps. Thanks to these solutions, developers are able to deploy applications without the need of infrastructures such as servers, operating systems, or development tools.


6 0
3 years ago
Other questions:
  • What are pixels that are the exact same between multiple frames called?
    15·1 answer
  • What tab contains the copy and paste buttons
    6·2 answers
  • A ________ allows a hacker to gain access to your computer and take almost complete control of it without your knowledge. zombie
    15·1 answer
  • Some files appear dimmed in one of the default folders on your computer. What would be the best course of action? A. Leave the f
    5·1 answer
  • Write a program that creates a dictionary containing the U.S. states as keys and their capitals as values. (Use the Internet to
    10·1 answer
  • In a period of steep increases in interest rates, which issuer is most likely to be negatively affected? A Trucking company B Ut
    9·2 answers
  • A look to different section of the same page is known as_____.
    7·1 answer
  • You must write a pseudocode process called swapSort which should sort a list of numbers using an algorithm called swap sort.
    13·1 answer
  • The person that includes the most and funniest memes (screenshot from the web) gets brainliest.
    5·1 answer
  • How to be gud at Friday night funk
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!