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
Which of the following is a goal of summarizing?
zhannawk [14.2K]

Answer:

b

Explanation:

its B mygee

5 0
3 years ago
Write a function named ilovepython that prints out I love Python three times. Then, call that function.
Brums [2.3K]

Answer:

The program to this question can be described as follows:

Program:

def ilovepython(): #defining a method

   for i in range(3): #defining a loop that print messasge three times

       print('I love Python')#print messasge

ilovepython() #calling the method

Output:

I love Python

I love Python

I love Python

Explanation:

Description of the python program can be described as follows:

  • In the above Python program, a method "ilovepython" is defined, inside the method a for loop is used, inside the loop print method is used, that print the message "I love Python".
  • In python for loop is used to iterate over series and we can execute a set of statements with the loop, tuple, series, once for each element in the list.
8 0
3 years ago
Are there any easy questions on Brainly?
icang [17]
If you want to answer easy questions click on answer at the bottom of your screen and then look at the top and click on school and choose a school (for example choose middle school because people have posted way questions) :)
6 0
3 years ago
Read 2 more answers
Is MS DOS a network operating system?​
chubhunter [2.5K]

Answer:

Operating systems now use networks to make peer-to-peer connections and also connections to servers for access to file systems and print servers. The three most widely used operating systems are MS-DOS, Microsoft Windows and UNIX.

Explanation:

7 0
3 years ago
assume for arithmetic, load/store, and branch instructions, a processor has CPIs of 1, 12, and 5, respectively. Also assume that
KonstantinChe [14]

Answer:

1 PROCESSOR :

(1 × 2.56 × 10^9) + (12 × 1.28 × 10^9) + (5 × 2.56 × 10^8) / 2 GHz = 9.6 s

2 PROCESSORS :

(1×2.56×10^9)+(12×1.28×10^9)/0.7×2 + (5 × 2.56 × 10^8) / 2 GHz = 7.04 s

Speed -up is 1.36

4 PROCESSORS :

(1×2.56×10^9)+(12×1.28×10^9)/0.7×4 + (5 × 2.56 × 10^8) / 2 GHz = 3.84 s

Speed -up is 2.5

5 PROCESSORS :

(1×2.56×10^9)+(12×1.28×10^9)/0.7×8 + (5 × 2.56 × 10^8) / 2 GHz = 2.24 s

Speed -up is 4.29

Explanation:  

The following formula is used in this answer:

EXECUTION TIME = CLOCK CYCLES / CLOCK RATE

Execution Time is equal to the clock cycle per clock rate

7 0
3 years ago
Other questions:
  • You need to add cells c3 and c7, and multiply c3 by c6. based on the order of operations, what would you do
    12·2 answers
  • The ? Tool removes blemishes and imperfections by sampling pixels around the spot and then paints withh matching texture, transp
    10·1 answer
  • When a computer is booted the checks the computer's components?
    7·1 answer
  • A acrostic sentence for mutualism?
    10·1 answer
  • The World Wide Web (not the Internet) went live in this decade:
    8·2 answers
  • Why is it helpful that the ribbon tabs can collapse?
    8·1 answer
  • A corporate user is attempting to connect to the company’s Windows domain server on the local network with her new laptop throug
    11·1 answer
  • How does digital camera differ than manula camera?​
    6·1 answer
  • What are the advantages of Database management system (DBMS)??<br>At least mention six of them​
    10·1 answer
  • Give one reason why more people prefer to settle in areas of flat land than on steep slopes​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!