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
We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac
MAXImum [283]

Answer:

abstract class Mark  //Creating an Abstract class{

abstract double getPercentage();}

class A extends Mark{

double result;

A( int val1, int val2, int val3){

 result=(val1+val2+val3)/3;}

double getPercentage(){

 return result;}}

class B extends Mark{

double result;

B(int val1, int val2, int val3, int val4){

 result=(val1+val2+val3+val4)/4;}

double getPercentage(){

 return result;}}

class Main{

public static void main(String args[]){

 //class A Object

 Mark obj_1=new A(10,20,30);

 System.out.println(obj_1.getPercentage());

 //class B Object

 Mark obj_2=new B(10,20,38,46);

 System.out.println(obj_2.getPercentage());}}

6 0
3 years ago
Think back over the information presented in the lesson about how you can skillfully use the Internet when doing research. Selec
madreJ [45]

Avoid wikipedia, anyone can put answers down on there and make it seem correct but it is not. Do not trust any website research the websites or look at ratings if possible. Use the answers that google provides itself if possible. And research trusted websites.

If this helped please mark me as brainlest.

\left[\begin{array}{ccc}Thanks,\\JustSomeIdiot\end{array}\right]

7 0
3 years ago
Which measure should you take for the periodic maintenance of your computer? You need to invest in a for_______________ the peri
Sergio039 [100]
I believe the answer is <span>annual maintenance
</span><span>annual maintenance refers to the system maintenance that being done at a regular time period (most commonly done at least every 6 month)
This is really necessary in order to detect potential virus/malware that would compromise the information within your computer.</span>
3 0
3 years ago
Read 2 more answers
If you see an advertisement for a 3TB portable drive, this is most likely a reference to the device having a capacity of three
Anika [276]
Hello there.

Question: <span>If you see an advertisement for a 3TB portable drive, this is most likely a reference to the device having a capacity of three _____.

Answer: It is 3 terabytes. .

Hope This Helps You!
Good Luck Studying ^-^</span>
4 0
3 years ago
9. Government and corporate officials concerned about security threats do not bring their own cell phones or laptops when travel
tatuchka [14]

Answer:

True

Explanation:

It is known as Don-Not-Carry rules are implemmented to avoid

-Unauthorized full disk copies (it have been made while the laptop owner was out of the hotel room on overseas travel)

-Laptops steals

- Monitoring by third parties of wireless using.

3 0
3 years ago
Other questions:
  • Rebooting the computer is a good troubleshooting technique.<br><br> True<br> False
    6·2 answers
  • During the ________ phase of the systems development life cycle process, developers construct, install, and test the components
    13·1 answer
  • Which technique helps you look confident as a speaker?
    15·1 answer
  • _____ _____ deals with the definitions properties of mathematical models of computation.
    8·1 answer
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    5·1 answer
  • Hazel has just finished adding pictures to her holiday newsletter. She decides to crop an image. What is cropping an image?
    10·1 answer
  • In troubleshooting a boot problem, what is the advantage of restoring all BIOS settings to their default values?
    6·1 answer
  • What are 3 examples of a idler gear in real life?
    7·1 answer
  • What is the value of the variable named result after the following code executes?
    10·1 answer
  • File names should be limited to 144 characters.<br><br> true or false
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!