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
If a thread is not finished running, perhaps because it had to wait or it was preempted, it is typically restarted on the same p
andrew11 [14]
<span>If a thread is not finished running, perhaps because it had to wait or it was preempted, it is typically restarted on the same processor that previously ran it.  This is this known as </span>processor affinity. 
4 0
3 years ago
What does FIFO mean?
zubka84 [21]
Hello there!

It is First In First Out

Hope This Helps You!
Good Luck :)
6 0
3 years ago
Read 2 more answers
Which pdu is processed when a host computer is de-encapsulating a message at the transport layer of the tcp/ip model?.
yulyashka [42]

The PDU that is processed when a host computer is de-encapsulating a message at the transport layer of the tcp/ip model is segment.

<h3>What is this PDU about?</h3>

Note that in the transport layer, a host computer is said to often de-encapsulate  what we call a segment so that they can be able to put back data to an acceptable or given format through the use of the application layer protocol that belongs to the TCP/IP model.

Therefore, The PDU that is processed when a host computer is de-encapsulating a message at the transport layer of the tcp/ip model is segment as it is the right thing to do.

Learn more about host computer from

brainly.com/question/553980

5 0
2 years ago
Given the following code segment, how can you best describe its behavior? i ← 1 FOR EACH x IN list { REMOVE(list, i) random ← RA
garik1379 [7]

Answer:

Well, this code would box the whole body of an html document. by using the relative value for position, you are telling it to position relative to its normal position, which the top left corner is at (0,0). by using left: 50px, you are telling the box to set the left margin edge to 50px and by using top: 50px, you are telling it to set the top margin edge to 50px. by doing this shifting, the top left corner of the box, which is at (0,0) would be positioned at (50,50)

6 0
3 years ago
What type of positive or negative impact has your technology topic had on society over the past 5 years?
Lana71 [14]
Positive 
1- helping us find things
2- help with communications
3- make life easier.
 Negative
1- spread people apart
2- cyberbullying
3-Hard for old people to use and understand.
6 0
3 years ago
Other questions:
  • Signe wants to improve the security of the small business where she serves as a security manager. She determines that the busine
    6·1 answer
  • Zach wants to learn a programming language to create games and applications. this programming language will also create web appl
    12·2 answers
  • What does the shell of an operating system do
    14·1 answer
  • Write a program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The name wil
    13·1 answer
  • Where can i watch bnha movie 2 online for free, with no sign up or pay?
    6·2 answers
  • The MAC address is a _____ bit number.
    10·2 answers
  • A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption
    10·1 answer
  • Does anybody know how to unlock websites from school computer
    7·1 answer
  • 15 _____ 3 = 0 Question 11 options: a) / b) % c) * d) //
    12·1 answer
  • DES is a commonly used symmetric encryption algorithm, developed in the mid-1990s by the American government in conjunction with
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!