answer.
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
Virty [35]
1 year ago
9

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

Computers and Technology
1 answer:
solmaris [256]1 year ago
8 0

Answer:

see explaination

Explanation:

Part 1:

import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int num1;

int num2;

int num3;

int num4;

int avg=0, pro=1;

num1 = scnr.nextInt();

num2 = scnr.nextInt();

num3 = scnr.nextInt();

num4 = scnr.nextInt();

avg = (num1+num2+num3+num4)/4;

pro = num1*num2*num3*num4;

System.out.println(pro+" "+avg);

}

}

------------------------------------------------------------------

Part 2:

import java.util.Scanner;

public class LabProgram {

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int num1;

int num2;

int num3;

int num4;

double avg=0, pro=1; //using double to store floating point numbers.

num1 = scnr.nextInt();

num2 = scnr.nextInt();

num3 = scnr.nextInt();

num4 = scnr.nextInt();

avg = (num1+num2+num3+num4)/4.0; //if avg is declared as a float, then use 4.0f

pro = num1*num2*num3*num4;

System.out.println((int)pro+" "+(int)avg); //using type conversion only integer part

System.out.printf("%.3f %.3f\n",pro,avg);// \n is for newline

}

}

You might be interested in
Explain how abstraction is used in a GPS system
Pavlova-9 [17]

Answer

Abstraction enables GPS system to facilitate the utilization of well defined interfaces while offering room to add additional levels of functionality which are complex to handle.

Explanation

GPS system applies abstraction to be able to arrange level of complexity on which a user will interact with the system. For example, it establishes a link of satellite positioned and timed systems to allow a radio receiver obtain a signal in four dimension after synchronizing the data of latitude, longitude, attitude and time.


7 0
1 year ago
Read 2 more answers
Information gathered from observing a plant grow 3 cm over a two-week period results in _______.a. inferences. b. variables. c.
Leya [2.2K]

Answer:

The answer is d. Data

Explanation:

information gathered from observing a plant grow 3 cm over a two-week period results in Data

data is facts and statistics collected together for reference or analysis.

Data is any information that has been collected, observed, generated or created to validate original research findings

6 0
2 years ago
System design is the determination of the overall system architecture-consisting of a set of physical processing components, ___
Alenkinab [10]

Answer:

C) Hardware, Software, People

Explanation:

System design is the determination of the overall system architecture-consisting of a set of physical processing components, Hardware, Software, People and the communication among them-that will satisfy the system’s essential requirements.

5 0
2 years ago
Read 2 more answers
A(n) _________ is a document containing an organization's policies for the ethical, secure, and appropriate use of computing res
blsea [12.9K]

Answer: a) acceptable use policy

Explanation:

  • Acceptable use policy (AUP) is a policy that is regarding the usage of internet services and other network facilities with certain responsibility , rights and regulations.
  • This policy governs the internet use being done till permitted extent and is not interrupting security and ethics for any reason in corporate world, school premises etc.
  • Other options are incorrect because privacy policy is made for maintaining privacy.Fair use policy permits limited amount of copyrighted components to be used. Digital rights is related with regulation of digital element and environment.
  • Thus, the correct option is option(a).

7 0
1 year ago
Which type of address is used at the transport layer to identify the receiving application?
monitta

Answer:

Port number  is used at the transport layer to identify the receiving application

Explanation:

Transport layer is responsible for overall “end-to-end” communication. It provides communication service to the application process which might be running on “different hosts”.

TCP (Transmission Control Protocol) or UDP (User Data Protocol) is the protocol used in the Transport layer. The port number is essential so that the transport layer can carry packets to the right destination pointing to the right application.

A port number usually contains 16 bit integer. Normally this number will send along with the header. Port number plays a major role in Transport layer.

5 0
1 year ago
Other questions:
  • Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
    11·2 answers
  • Secure Wi-Fi networks and VPNs use _____ to secure data transferred over a network.
    13·1 answer
  • Which of the following are true statements about digital certificates in Web browsers?I. Digital certificates are used to verify
    10·1 answer
  • A company wants to publish Knowledge articles to its Customer Community. The articles should be organized for easy navigation by
    6·1 answer
  • "online privacy alliance (opa) is an organization of companies dedicated to protecting online privacy. members of opa agree to c
    15·1 answer
  • Write a client program that writes a struct with a privateFIFO name (call it FIFO_XXXX, where XXXX is the pid that you got from
    11·1 answer
  • You are using a polynomial time 2-approximation algorithm to find a tour t for the metric traveling salesman problem. Which of t
    7·1 answer
  • Which of the following is true of how computers represent numbers?
    9·2 answers
  • Television broadcasts were originally delivered by using which technology
    14·1 answer
  • A drive is small enough to be carried in one's pocket.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!