Table of Contents

    Assignment: Calculate Sum and Average of Three Numbers

    Assignment: Calculate Sum and Average of Three Numbers

    Problem Statement:

    Write a Java program that prompts the user to enter three numbers, calculates their sum, and then computes the average. The program should display both the sum and the average as output.

    Requirements:

    1. Prompt the user to input three numbers.
    2. Calculate the sum of these three numbers.
    3. Compute the average of the three numbers.
    4. Display the sum and average with appropriate messages.

    Example Output:

    • Input: 10, 20, 30
      • Sum: 60
      • Average: 20.0
    • Input: 15, 25, 35
      • Sum: 75
      • Average: 25.0

    Hints:

    • Use the Scanner class for input.
    • Remember to cast the sum to double if you want the average as a floating-point number.
    • You can calculate the average by dividing the sum by 3.