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
Reil [10]
3 years ago
11

Given 4 integers, output their product and their average, using integer arithmetic.

Computers and Technology
1 answer:
zaharov [31]3 years ago
8 0

Answer:

import java.util.Scanner;

public class num10 {

   public static void main(String[] args) {

   Scanner scnr = new Scanner(System.in);

   int num1 = scnr.nextInt();

   int num2 = scnr.nextInt();

   int num3 = scnr.nextInt();

   int num4 = scnr.nextInt();

   int product = num1*num2*num3*num4;

   int average = (num1+num2+num3+num4)/4;

   System.out.println(product+" "+average);

   // Part Two

   double prod = num1*num2*num3*num4;

   double ave =  (double)(num1+num2+num3+num4)/4;

   System.out.printf("%.3f", prod);

   System.out.println();

   System.out.printf("%.3f", ave);

   }

}

Explanation:

As required in the question, four variables are created to hold values for num1, num2,num3,num4.

The product  is evaluated:  int product = num1*num2*num3*num4;

The average is evaluated: int average = (num1+num2+num3+num4)/4;

These are output to the screen

In part two;

The product and average are declared as type double so as to hold floating point number

double ave =  (double)(num1+num2+num3+num4)/4; In order to avoid integer division which discards the remainder, a type casting is performed on the 4 input variables.

Finally using printf method new values of product and average is outputed.

You might be interested in
How many possible keys does the playfair cipher have? an approximate power of 2
Lorico [155]
I don't know but I am guessing 666 or 777 or 888.
7 0
3 years ago
you have been tasked with configuring a digital information station in the office's lobby. guests will be able to use the statio
REY [17]

The most important security consideration for the station is code signing. With code signing, consumers may feel confident about the software they are downloading and can stop worrying about infecting their computer.

With code signing, consumers may feel confident about the software they are downloading and can stop worrying about infecting their computer or mobile device with malware. Code signing has grown in importance for software developers and distributors as more software may be downloaded from the Internet.

Malware can be easily installed on a victim's computer by an attacker who poses as a trustworthy source. As long as users only download software that is regarded as safe by their operating system, code signing ensures that these types of assaults cannot happen.

Nowadays, the Operating System looks for the digital certificate produced through code signing when software is downloaded onto a computer to ensure the security of the software being installed. The user is informed and given the option to stop or continue the installation if no digital certificate is detected.

To know more about code signing click here:

brainly.com/question/28860592

#SPJ4

3 0
1 year ago
What is a tag in an HTML document?
Llana [10]

Answer: HTML is considered as the Lingua franca of the net that is a simple mark up language used for the purpose of web publishing for creating text and images. This can be viewed by any of the member and can be used within any browser. There is no need of special software for creating HTML pages and moreover the learning of HTML is pretty easy.

Explanation: If you need more help go follow me at dr.darrien

- thank you

3 0
4 years ago
Read 2 more answers
How many bits are required to encode an image that is 25 pixels wide and 50 pixels tall, if you encode each pixel with 12 bits o
AURORKA [14]

Just multiply all numbers to get the total number of bits:

25*50*12 = 15000 bits.

3 0
3 years ago
By default, PowerPoint ends a slide show with a black slide. <br> a. True<br> b. False
Dmitry [639]
True . Because Press " ESC " To Exit Off Of Slide . 
5 0
4 years ago
Read 2 more answers
Other questions:
  • The underline format will underline ____.
    14·1 answer
  • Which of these computers was marketed as a computer/game machine?
    15·2 answers
  • Which of the following statements about Linux is not​ true? A. Linux works on all the major hardware platforms. B. It plays a ma
    5·1 answer
  • Given the three side lengths, how can you tell if a triangle<br>is a right triangle?​
    5·1 answer
  • Which of the following describes the function of a web browser?
    11·1 answer
  • What specific record type is found in every zone and contains information that identifies the server primarily responsible for t
    10·1 answer
  • 6.8 Code Practice<br> please can have some help please
    8·1 answer
  • Edhesive 2.3 code practice question 1​
    11·1 answer
  • How does digital and hybrid computers differ in portability​
    9·1 answer
  • 9.2 lesson practice ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!