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
spin [16.1K]
3 years ago
8

Write a java program which uses methods for calculating the sum of any 5 non-zero integer digits that are input. The program mus

t use scanner for input of the 5 digits. Two Methods must be used, one for calculating the sum of the 5 digits
Computers and Technology
1 answer:
zheka24 [161]3 years ago
3 0

Answer:

public class num1 {

   public static void main(String[] args) {

   //Calling the method Calculate

       calculate();

   }

//Method Calculate

   public static void calculate() {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter five numbers greater than 0");

       int sum =0;

       for(int i =0; i<5; i++){

           System.out.println("Enter the "+(i+1)+" number");

           sum+=in.nextInt();

       }

       System.out.println("The sum of the five numbers is: "+sum);

   }

}

Explanation:

  • Two Methods are created in Java Programming Language
  • The main method and the method calculate()
  • The calculate method uses a  for loop to request users to enter five numbers
  • Every number entered is added to the sum initially set to 0
  • The sum is printed at the end
  • In the main method, calculate is called.
You might be interested in
A network administrator wants to change the frequency of their wireless network to allow more channels that do not interfere wit
MA_775_DIABLO [31]

Answer:

2.4GHz

Explanation:

In the 2.4 GHz band, 1, 6, and 11 are the only non-overlapping channels

8 0
3 years ago
Use the commands you've learned so far to draw a
Murrr4er [49]

The app you shown in the picture is that app scracth?

8 0
3 years ago
What is the transfer rate of DDR memory?<br> A. 16 bit <br> B. 32 bit <br> C. 64 bit <br> D. 128 bit
marshall27 [118]
C. 64 bit is the answer
3 0
3 years ago
Read 2 more answers
What tool checks the spelling of each word against the programs internal dictonary?
Darina [25.2K]
Answer: Spell checker tool
5 0
3 years ago
Why do you think there needs to be a specific code of ethics for health-related information on the Internet?
Firlakuza [10]
Ethical health research and privacy protections both provide valuable benefits to society. Health research is vital to improving human health and health care. Protecting patients involved in research from harm and preserving their rights is essential to ethical research. The primary justification for protecting personal privacy is to protect the interests of individuals. In contrast, the primary justification for collecting personally identifiable health information for health research is to benefit society. But it is important to stress that privacy also has value at the societal level, because it permits complex activities, including research and public health activities to be carried out in ways that protect individuals’ dignity. At the same time, health research can benefit individuals, for example, when it facilitates access to new therapies, improved diagnostics, and more effective ways to prevent illness and deliver care
7 0
3 years ago
Read 2 more answers
Other questions:
  • Ana works in the medical records department at a large medical office. Her job includes scanning and uploading medical records i
    15·1 answer
  • Which of the following statements is false?
    12·1 answer
  • A ____ is a type of program that uses a grid to organize and work with data.
    14·1 answer
  • What is the difference between ARM and INTEL Chip?
    6·1 answer
  • A friend is having a problem with keeping a fish tank at the right temperature so the fish stay healthy. Describe how you could
    9·1 answer
  • A bicycle combination lock has four rings with numbers 0 through 9. Given the actual numbers and the combination to unlock, prin
    13·1 answer
  • The _____ dialog box lets you specify which files are to be merged.
    14·1 answer
  • Does anyone know how to fix this???
    11·1 answer
  • An end-user license agreement protects _____.
    7·1 answer
  • What are the five generations of computer software​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!