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
Paladinen [302]
3 years ago
15

Write a program that reads three whole numbers and displays the average of the three number. Sample Run #: java Average3 Interac

tive Session.
1. Enter the first integer: 8
2. Enter the second integer: 10
3. Enter the third integer: 18
The average of 8, 10, and 18 = 12.0.
Computers and Technology
1 answer:
Maksim231197 [3]3 years ago
4 0

Answer:

The program to this question as follows:

Program:

import java.util.*; //import package

class Average //defining class Average

{

public static void main(String[] args) //defining main method

{

int a1,b2,c3;//defining integer variable

float avg; //defining float variable

Scanner obz=new Scanner(System.in); //creating scanner class object

System.out.print("input first number: "); //print message

a1=obz.nextInt(); //input value by user

System.out.print("input second number: "); //print message

b2=obz.nextInt(); //input value by user

System.out.print("input third number: "); //print message

c3=obz.nextInt(); //input value by user

avg=a1+b2+c3/3; //calculating average

System.out.print("The average of "+a1+","+b2+",and "+ c3+"="+ avg);//print value    

}

}

Output:

input first number: 8

input second number: 10

input third number: 18

The average of 8,10,and 18=24.0

Explanation:

In the above code, a class "Average" is defined inside this class the main function is declared in this method three integer variable "a1, b2, and a3" is declared, which input the value from the user side. in this method, a float variable avg is defined that calculates its average value.

  • In the next step, a scanner class object is created, that uses the above integer variable values.  
  • In the "avg" variable add all integer variables then divide its value by 3. At the print, method is used that prints avg variable value.
You might be interested in
Alison discovers that a system under her control has been infected with malware, which is using a key logger to report user keys
Bond [772]

Mostly the spyware and malware protection for desktop and laptop or workstations are to protected with anti-virus regular updates. All workstation or desktop or laptops are to updated operating systems patches.

If any operating systems patched update to be schedule and checked regularly. Schedule scanning by virus scanner to be made for desktop and laptop or workstations in regular interval basis

There are third parties tools such as malware and ADWCLEANER are also available free scanner software through internet where end user can download and scanner so software will clean the malware.

Mostly end user do mistake keep the files in desktop. Most of the malware software will affect the desktop folder only.

It will also affect c:\users folder and register enter keys.

7 0
3 years ago
The ____ layer of the osi model performs a series of miscellaneous functions necessary for presenting the data package properly
Darya [45]
The "transport" layer of the OSI model performs a series of miscellaneous functions
Machine function also called miscellaneous functions—influence. positive functions on the machine, such as diverting the spindle rotation and coolant on and off, the path action of the tool, and the program beheading.
7 0
2 years ago
Reimplement StringSet with the exception that it should now extend ArrayList instead of encapsulating a String[]. You can easily
kolbaska11 [484]

Answer:

Here is the program for the given question

Explanation:

class StringSet

{

ArrayList<String> arraylist; //a reference variable of ArrayList of generic type String

//A no argument constructor.

public StringSet()

{

arraylist=new ArrayList<String>(); //instantiating the ArrayList object

}

//A mutator that adds a String newStr to the StringSet object.

void add(String newStr)

{

arraylist.add(newStr); // add(String) method to add string to the arraylist

}

//An accessor that returns the number of String objects that have been added to this StringSet object.

int size()

{

return arraylist.size(); // size() method which gives the number of elements in the list

}

//An accessor that returns the total number of characters in all of the Strings that have been added to this StringSet object.

int numChars()

{

int sum = 0;

for(String str:arraylist) //for-each loop; can be read as for each string in arraylist

{

sum+=str.length();

}

 

return sum;

}

//An accessor that returns the number of Strings in the StringSet object that have exactly len characters.

int countStrings(int len)

{

int count = 0;

for(String str:arraylist)

{

if(str.length() == len)

count++;

}

return count;

}

}

4 0
3 years ago
aquatic life zone such as acorans and their bays, estuaries, coastal wetlands, shorelines, coral reffs and mangrove forests?
Oksana_A [137]

Answer:

Iajajkwbwiw whw

Explanation:

Bshsiwiqnqiaowpwownsbbsdk akakwjnwkwnwkwnwoqknanamamalamkakakskwkwkwnwmw.

I hope u liked my answer. Thank u

6 0
3 years ago
In the water cycle,lake water will do which of the following first
Agata [3.3K]

What are the following?

5 0
2 years ago
Other questions:
  • When sociologists say that it is difficult to predict all the results of social change, what are they referring to?
    5·1 answer
  • The length of a pencil would most likely be measured in:
    9·2 answers
  • in c Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the li
    14·1 answer
  • How would a programming language that allows programs to run on any operating system be classified?
    11·1 answer
  • A subclass of Value, LargerValue, is defined with a getValue method that returns twice the value of the parent. Which line is th
    13·1 answer
  • What is the purpose of the print area feature​
    11·1 answer
  • A keyboard would be considered _____. Select 2 options.
    13·2 answers
  • What when can you expect technology to be effective?
    12·1 answer
  • Using C++
    13·1 answer
  • Task 2
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!