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]
2 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]2 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 statement is true for slide or positive film?
Hitman42 [59]

Answer:

B.

Slides or positive films give high quality pictures with higher color saturation and contrast.

Explanation:

The above is true for slides with positive film. This is because, the positive film happens to have a high resolution when it was been used thereby giving out a high quality video at the end of the recording. The higher colour saturation and contrast are also an attribute of a slide  or positive film.

6 0
2 years ago
Frances is rearranging her furniture. (1) Also, she is moving the heavy oak bookcase to the back bedroom. (2) She has decided to
lozanna [386]

The first sentence that seems out of the logical order is the very first sentence, i.e, Also, she is moving the heavy oak bookcase to the bedroom.

A.  1

<u>Explanation:</u>

The fact that the sentence uses words like "she" and "also" leads to this conclusion. The logical order should move in a forward direction with the sentences forming a logical sequence.

The first sentence's structure is adding details to the actions which are already in progress and hence it should not be the first sentence. It should appear after the process of moving furniture has been started and further details are being added to it.

3 0
2 years ago
Read 2 more answers
Jabari created new video game for his coding course. What is one way he should format his pseudocode?
AleksAgata [21]

Answer:

Last one is the only logical one.

Explanation:

Hope this helps!!!

8 0
3 years ago
Write an algorithm to print the minimum and maximum of an integer array. Your need to pass the array as a parameter. Since we ca
sammy [17]

Answer:

See explaination

Explanation:

MinMax.java

import java.util.*;

public class MinMax

{

static void MinMax(int[] arr)

{

int Min=arr[0]; // initializinf min and max with 1st value of array

int Max=arr[0];

for(int i=0;i<arr.length;i++) // iterating loop only once

{

if(arr[i]>Max) // checking max value

{

Max=arr[i];

}

if(arr[i]<Min) // checking min value

{

Min=arr[i];

}

}

System.out.println("Min Number is "+Min); //printing min value

System.out.println("Max Number is "+Max); //printing max value

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter N value: "); // taking n value

int n=sc.nextInt();

int[] arr=new int[n];

System.out.println("Enter N elements:"); // taking n elements into array

for(int i=0;i<n;i++)

{

arr[i]=sc.nextInt(); // each element into the array

}

MinMax(arr); // calling MinMax() method.

}

}

4 0
3 years ago
Which motherboard slot should you install a new high-end graphics card in?
hram777 [196]

Answer:

The latest PCIe ×16 primary slot top near to CPU should be the answer to this question.

6 0
2 years ago
Other questions:
  • Janice usually works on a particular workbook that contains all business related data. She decides to keep a backup of all the d
    7·2 answers
  • Imagine you are responsible for making a presentation that includes a representation of the logic flow through a process. You un
    11·1 answer
  • If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allow
    8·1 answer
  • Write a program that rolls two dice until the user gets snake eyes. You should use a loop and a half to do this. Each round you
    10·1 answer
  • What is the shortcut to select all text?
    12·2 answers
  • Wilma is looking for facts about social media for her research project. What fact should she use for her project?
    15·1 answer
  • How scientist and technology beliefs society
    14·1 answer
  • Which of the following is equivalent to (p&gt;=q)? <br> i) P q iv) !p Where are genius people?:)
    6·1 answer
  • A Web site that allows users to enter text, such as a comment or a name, and then stores it and later display it to other users,
    12·2 answers
  • for a given array of integers perform operations on the array return the resulting array after all operations have been applied
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!