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
Write a statement to declare a variable x with data type int and initialise with the value 10​
nexus9112 [7]

Answer:

int x = 10;

Explanation:

This would work in many languages (C/C++/C#/Java).

6 0
2 years ago
Can someone compress this ipv6 address? 558c:0000:0000:d367:7c8e:1216:0000:66be
zaharov [31]

558c::d367:7c8e:1216:0:66be

7 0
2 years ago
A.Direction: identify the following examples of the ingredients used for sandwiches.
Orlov [11]

Answer:

i dont know how to answer may module because i dont have helper

8 0
2 years ago
letter grades, whereas other courses assign a percentage between 0 and 100. Still others assign a pass/fail grade. Write an inte
Dimas [21]

Answer:

See attached file for detailed code.

Explanation:

See attached file.

Download txt
6 0
3 years ago
Select all phrases that describe a server-based network. centralized network security easy to expand log-ins controlled by centr
slamgirl [31]

Answer:

Client Server Network ... is the central computer that enables authorized users to access networked resources ... computers in this type of network are connected to a central hub ... why might a business choose a server based network (3) ... 2) easier to expand ... external hardware connected to and controlled by a computer.

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • _______ are unprocessed facts that a computer feeds on.
    5·1 answer
  • Double clicking a word selects the entire word?
    9·2 answers
  • What is the local portion of the e-mail address below? <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="
    14·1 answer
  • Write a program that determines a student's letter grade. Allow the user to enter three test scores. The maximum score on each t
    9·1 answer
  • What Will Social Media Look Like in the Future?
    6·1 answer
  • A technician has been asked to upgrade a processor and needs to do some research. The computer is just a couple of years old. Wh
    13·1 answer
  • Which option represents the location of the Goal Seek function?
    8·2 answers
  • Write a technical term for following statements
    15·1 answer
  • Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class
    13·1 answer
  • MSWord is a popular___________ program.​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!