79715800

Date: 2025-07-26 15:45:45
Score: 0.5
Natty:
Report link
import java.util.Scanner;

public class PeopleWeights {
   public static void main(String[] args) {
      Scanner scnr = new Scanner(System.in);
      double[] weights = new double[5];
      double total = 0.0;
      double max = 0.0;

      for (int i = 0; i < 5; i++) {
         System.out.println("Enter weight " + (i + 1) + ": ");
         weights[i] = scnr.nextDouble();
         total += weights[i];
         if (weights[i] > max) {
            max = weights[i];
         }
      }

      System.out.println();
      System.out.print("You entered: ");
      for (int i = 0; i < 5; i++) {
          System.out.print(weights[i] + " ");
      }

      double average = total / 5.0;

      System.out.println("\nTotal weight: " + total);
      System.out.println("Average weight: " + average);
      System.out.println("Max weight: " + max);

      scnr.close();
      return;
   }
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user30967634