Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

java.

I am having an issue with my lab is there someone who can help me with this Lab.

import java.text.DecimalFormat;

import java.util.Scanner;

Need assignment help for this question?

If you need assistance with writing your essay, we are ready to help you!

OUR PROCESS

Order

Payment

Writing

Delivery

Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality

public class PeopleWeights {

  public static void main(String[] args) {

   Scanner scnr = new Scanner(System.in);

   int i = 0;

   int n = 5;

   double arr[] = new double[n];

   for (i = 0; i < n; ++i){

   System.out.println(“Enter weight ” + (i + 1) + “: “);

     arr[i] = scnr.nextDouble();

  }

    System.out.println();

    System.out.print(“You entered:”);

    for (i = 0; i < n; ++i) {

      System.out.print(arr[i] + ” “);

  }   

    double total = 0;

    double max = 0;

   for (i = 0; i < n; ++i){

     if(max > arr[i]){

      max = arr[i];

  }

   total = total + arr[i];

  }

     System.out.println();

     DecimalFormat df = new DecimalFormat(“#.##”);

     DecimalFormat df2 = new DecimalFormat(“#.##############”);  

     double average = total/n;

     System.out.println(“Total weight: “+df.format(total));

     System.out.println(“Average weight: “+df2.format(average));

     System.out.println(“Max weight: “+ (max));

   return;

  }

}

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"