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
ehidna [41]
3 years ago
8

Write an application named SumInts that allows the user to enter any number of integers continuously until the user enters 999.

Display the sum of the values entered, not including 999.
Computers and Technology
1 answer:
Nana76 [90]3 years ago
4 0

Answer:

import java.util.Scanner;

public class num10 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter the numbers to add up. enter 999 to stop");

       int num = in.nextInt();

       int sum = 0;

       while (num!=999){

           sum = sum+num;

           System.out.println("Enter the next number");

           num = in.nextInt();

       }

       System.out.println("The sum is: "+sum);

   }

}

Explanation:

The application is implemented in Java

A while loop is used to continously prompt user for inputs. The condition of the while loop is  while (num!=999)

When the number 999 is entered, it displays the sum which is initialized to 0

You might be interested in
Assume the following variable definition appears in a program:
AnnZ [28]

Answer:

cout << setprecision(2)<< fixed << number;

Explanation:

The above statement returns 12.35 as output

Though, the statement can be split to multiple statements; but the question requires the use of a cout statement.

The statement starts by setting precision to 2 using setprecision(2)

This is immediately followed by the fixed manipulator;

The essence of the fixed manipulator is to ensure that the number returns 2 digits after the decimal point;

Using only setprecision(2) in the cout statement will on return the 2 digits (12) before the decimal point.

The fixed manipulator is then followed by the variable to be printed.

See code snippet below

<em>#include <iostream>  </em>

<em>#include <iomanip> </em>

<em>using namespace std;  </em>

<em>int main()  </em>

<em>{  </em>

<em> // Initializing the double value</em>

<em> double number = 12.3456;  </em>

<em> //Print  result</em>

<em> cout << setprecision(2)<< fixed << number;  </em>

<em> return 0;  </em>

<em>}  </em>

<em />

4 0
3 years ago
Write convert() method to cast double to int Complete the convert() method that casts the parameter from a double to an integer
alexgriva [62]

Answer:

Write convert() method to cast double to int Complete the convert() method that casts the parameter from a double to an integer and returns the result. Note that the main() method prints out the returned value of the convert() method.

Ex: If the double value is 19.9, then the output is: 19

Ex: If the double value is 3.1, then the output is: 3

Explanation:

<h3>plz bhai mera answer ko brainliest kar do.....</h3>
8 0
3 years ago
Someone who participates online for social reasons usually has a:
Gwar [14]

I would say A.Informal and casual online persona

7 0
3 years ago
How have computers changed overtime
sattari [20]
So in the beginning, a regular computer took up the space of an entire room it was literally that big in size. now and days computers are this small object that you can carry around with you in your bag.
4 0
3 years ago
Read 2 more answers
What is the difference between morals and ethics?
Kipish [7]

<u>Answer</u>:

<em>B. Morals are individually held beliefs, while ethics are imposed by an </em>

<em>organization.</em>

<u>Explanation</u>:

<em>Morals are the beliefs designed or created by group of people.</em> It is concerned whether an action is right or wrong. It is basically a lesson learned from a situation or a story. <em>It also convey truth.  </em>

Ethics are set of rules designed by <em>external agent or organization</em> and it differs from place to place but they have basic ethics in common.

<em>It is a branch of philosophy. These are also not relative to the situation. Both moral and ethics are used interchangeably. </em>

6 0
4 years ago
Other questions:
  • Is Windows a:<br><br> A.operating system<br> B.software<br> C.hardware<br> D.input device
    12·1 answer
  • URGENT!! You decide not to use any recipes or information from the "Don't Be an Animal Murderer" Web site. What characteristic o
    7·2 answers
  • Write a C or C program A6p2.c(pp) that accepts one command line argument which is an integer n between 2 and 4 inclusive. Genera
    9·1 answer
  • Create a SavingsAccount class. Use a static data member annualInterestRate to store the annual interest rate for each of the sav
    10·1 answer
  • Computers that have multiple CPUs within a single computer, sharing some or all of the system's memory and I/O facilities, are c
    15·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    9·1 answer
  • How many characters should a strong password have? four six eight ten
    10·2 answers
  • Brainliest For Tascake Because People Texted Before Tascake Could<br><br> Hurry Tascake
    13·2 answers
  • Can someone help me and explain
    5·1 answer
  • Which statements are TRUE about web services protocols? (Select TWO responses) SOAP and REST are both web service communication
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!