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
Naddik [55]
3 years ago
14

Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of integer

s and an int variable named total, write the code necessary to add all the integers in the input source and place their sum into total.
Computers and Technology
2 answers:
DedPeter [7]3 years ago
7 0
The answer is total = 0;while(input.hasNextInt()){total += input.nextInt( );}   Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of integers and an int variable named total, The code necessary to add all the integers in the input source and place their sum into total is :                                                  total = 0;while(input.hasNextInt()){total += input.nextInt( );}   
liq [111]3 years ago
7 0

Answer:

Following are the code written in the Java Programming Language.

total = 0;   //set integer type variable and initialize to 0

while(input.hasNextInt()){   //set the while loop

total += input.nextInt( );  //code is here

}

Explanation:

Here, in the following code create the reference scanner class object i.e., "input".

  • Then, we set integer data type variable "total" and initialize 0 in it.
  • then, we set the while loop and pass the following condition "input.hasNextInt()".
  • Then, we add all integer values and store their sum in the variable "total".
You might be interested in
Write a complete program that asks the user to input the height and radius of a cone (both of type double) and calls two individ
Vika [28.1K]

Answer:

The program in C++ is as follows:

#include <iostream>

#include <math.h>

using namespace std;

double area(double r, double h){

   double A = 3.14 * r * (r + sqrt(h*h + r*r));

   return A;}

double volume(double r, double h){

   double V = (1.0/3) * 3.14 * r*r * h;

   return V;}

int main(){

   double radius, height;

   cout<<"Radius: "; cin>>radius;

   cout<<"Height: "; cin>>height;

   cout<<"Area: "<<area(radius,height)<<endl;

   cout<<"Volume: "<<volume(radius,height);

   return 0;

}

Explanation:

This declares the area function

double area(double r, double h){

Calculate area

   double A = 3.14 * r * (r + sqrt(h*h + r*r));

Return the calculated area

   return A;}

This declares the volume method

double volume(double r, double h){

Calculate volume

   double V = (1.0/3) * 3.14 * r*r * h;

Return the calculated volume

   return V;}

The main begins here

int main(){

Declare radius and height

   double radius, height;

Get input for radius

   cout<<"Radius: "; cin>>radius;

Get input for height

   cout<<"Height: "; cin>>height;

Call the area function and print the returned value for area

   cout<<"Area: "<<area(radius,height)<<endl;

Call the volume function and print the returned value for volume

   cout<<"Volume: "<<volume(radius,height);

   return 0;

}

4 0
3 years ago
Hi please help ASAP it's about html!​
uranmaximum [27]
<h2><u>Given</u> :-</h2>

Create a HTML code for writing a web page for your school time-table.

<h2><u>Answer</u> :-</h2>

<html>

<head>

<title> Time Table </title>

</head>

<hrcolor = "red">

<hrcolor = "blue">

<body>

<table><tr = "7"><md = "7"><Period 1_></table>

</body>

</html>

\\

Answered by - ItzMaster

7 0
3 years ago
Your mobile device has gone over its subscribed data limit the past two months. During this time, you have noticed that the devi
Zolol [24]

Answer:D. The device needs an operating system update

Explanation:Operating systems are different programs mainly manufactured by software companies like Microsof,Apple etc, after initially installation are loaded into the computer by a boot program, operating systems manages all of the other application programs in a computer, it requires constant upgrade in order to be able to effectively carry out its activities. Application programs uses the operating system by making requests for services through a defined application program interface (API). Examples include Windows 7, Windows 8, Windows 10, Blackberry OS, Operating system Linux etc.

6 0
3 years ago
How does Wireshark differ from NetWitness Investigator?
nikdorinn [45]

Answer is given below

Explanation:

  • Wireshark differ from NetWitness Investigator because
  • Windshark shows a detailed view of individual packets.
  • WireShark captures live traffic and displays the results at the packet level.
  • Netwitness shows a high-level view and can be compared to the new packet capture
  • NetWitiness Investigator provides a comprehensive overview of previously tracked traffic that can be used to view anomalies, compliance and attacks.
8 0
3 years ago
Does technology need to be kept alive?
tamaranim1 [39]

Answer:

Explanation:

well we don’t need it we just use it =) hope it helps

7 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in
    15·1 answer
  • #In chemistry, the ideal gas law states:
    5·1 answer
  • Which statement about trees is false?
    12·1 answer
  • If the mine winch drum diameter is 6M, how far will the counterweight lift for each single rotation of the drum
    11·1 answer
  • What is an LMS and how is it used?
    8·1 answer
  • Name this<br><br>The feature allows you to add text/picture in the background of the document. ​
    11·1 answer
  • Let's practice Audience analysis by going to the Google Merchandise Store demo account with a date range of Feb 1, 2016 - Feb 29
    13·1 answer
  • on the road you are traveling,the pavement markings change from broken white lines to solid white lines between the lanes of tra
    5·1 answer
  • A collection of computers, printers, routers, switches, and other devices
    15·1 answer
  • Vector images take up much less space when saved to a computer or storage device because computers and storage devices just need
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!