Question

1. Write a program using BlueJ and Java to compute the average of three numbers, we...

1. Write a program using BlueJ and Java to compute the average of three numbers, we will assume these numbers are test scores, so the range the numbers can be are 0-100.

2. The three numbers you will use are: 80, 90, and 95.

3. The average is calculated by adding the three numbers and dividing the sum by three.

4. Your output should look similar to this: Your test score average is: 88

0 0
Add a comment Improve this question Transcribed image text
Answer #1
//You should save the below code as Average.java
import java.util.Scanner;
public class Average {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        // Prompt for three numbers
        System.out.println("Enter three numbers:");

        // Reading three numbers
        int n1 = scan.nextInt();
        int n2 = scan.nextInt();
        int n3 = scan.nextInt();

        // Calculating sum
        int sum = n1+n2+n3;

        // Calculating average
        int avg = sum/3;

        // Printing average of three numbers
        System.out.println("Your test score average is: "+avg);

    }
}

Add a comment
Know the answer?
Add Answer to:
1. Write a program using BlueJ and Java to compute the average of three numbers, we...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT