Question

I know there is a similar problem answered but it didnt quite work for me. Can...

I know there is a similar problem answered but it didnt quite work for me. Can i have in in windows form please. i really dont understand this one

Sales analysis

Modify the application that you created in programming exercise 1 so it also displays the following:

Average values in the array

Largest Value in the array

Smallest Value in the array

0 0
Add a comment Improve this question Transcribed image text
Answer #1


public class Sales {
   //return average in an array
   public double averageValue(int[] arr){
       int sum = 0;
       for(int i=0;i<arr.length;i++){
           sum=sum+arr[i];
       }
       return (sum*1.0)/arr.length;
   }
   // return largest in an array
   public int largestValue(int[] arr){
       int largest = arr[0];
       for(int i=0;i<arr.length;i++){
           if(arr[i]>largest)
               largest = arr[i];
       }
       return largest;
   }
   // return smallest in an array
   public int smallesrValue(int[] arr){
       int smallest = arr[0];
       for(int i=0;i<arr.length;i++){
           if(arr[i]<smallest)
               smallest = arr[i];
       }
       return smallest;
   }
}

Add a comment
Know the answer?
Add Answer to:
I know there is a similar problem answered but it didnt quite work for me. Can...
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
  • hi i dont know and understand what this assignment wants me to do can some please...

    hi i dont know and understand what this assignment wants me to do can some please explain it to me thank you Modify the print_face function to have a third parameter mouth and use it in the final print statement. def print_face(eye, face_char): print(' ', eye, ' ', eye) # Print eyes print(' ', face_char) # Print nose print(' ', face_char*5) # Print mouth return print_face('o', 'x')

  • Please Do It With Java. Make it copy paste friendly so i can run and test...

    Please Do It With Java. Make it copy paste friendly so i can run and test it. Thnak You. Write programs for challenges 1 and 2 and 6 at the end of the chapter on Generics. 1) Write a generic class named MyList, with a type parameter T. The type parameter T should be constrained to an upper bound: the Number class. The class should have as a field an ArrayList of T. Write a public method named add, which...

  • Could you please help me to solve this exercise? I know it is quite long but...

    Could you please help me to solve this exercise? I know it is quite long but please try to do as much as your are allowed to do. It is very complicated and too difficult to me I m very grateful if you can prove the formulas so I can understand how the numbers come from. Many thanks I d to write clearer here the Ending Inventory at the last row of the photo: Ending Inventory is $34,000 More detailed...

  • Can you please help me to solve this exercise? I know it is quite long but...

    Can you please help me to solve this exercise? I know it is quite long but please try to do as much as your are allowed to do. Thank you 5.- (Pressure and energy density of electromagnetic radiation) Consider the electromagne- tic radiation (photon gas) contained in an edge box Lg, Ly and L2. As an image moves with the speed of light, it is a relativistic particle. Therefore, its energy e is related to its moment hK through: ะบ3)12...

  • Could you please help me to solve this exercise, i know it is quite long, but...

    Could you please help me to solve this exercise, i know it is quite long, but please do as much as as you are allowed to do. I appreciate very much if you can explain in details how the numbers come from so that I can apply using the way for similar exercises Many thanks ) Cost assisgnment Evercise NYz manufactures two products: A and the following per-unit information A rview of the company accounting records revealed per-unit intformation Production...

  • C++ Can someone please help me with this problem- commenting each line of code so I...

    C++ Can someone please help me with this problem- commenting each line of code so I can understand how to solve this problem using the C++ programming language? I really need help understanding how to create a file for the program to read. Do I create the file in Visual basic or create a text file? I have the code, just need to know how to create the file for it to read. #include<fstream> #include<iostream> using namespace std; int main()...

  • THIS NEEDS TO BE ANSWERED IN MATLAB CODING ONLY please use screen shots so I can...

    THIS NEEDS TO BE ANSWERED IN MATLAB CODING ONLY please use screen shots so I can follow along because these two questions have been answered, but I do not understand how it works! See problems under image below.... I KNOW HOW TO CALCULATE ALL OF THESE PROBLEMS ALREADY I DON'T KNOW HOW TO CODE IN MATLAB, so if possible show me the steps so I understand, Thank you. ALSO CAN YOU PLEASE ONLY USE ONE (1) function M FILE my...

  • Could you please help me to solve this exercise? I know it is quite long but please try to do as much as your are allowe...

    Could you please help me to solve this exercise? I know it is quite long but please try to do as much as your are allowed to do. Thanks 2. (Average Energy of rotation of a diatomic molecule) The kinetic energy of a diatomic molecule, which revolves around an axis perpendicular to the line that joins the two atoms, is classically given by: 2 2I where L is the angular momentum vector and I is the inertial tensor. In a...

  • Can you guys make comments on this post I think its a great idea that Apple...

    Can you guys make comments on this post I think its a great idea that Apple created an application on smart phones to have patients medical records handy. One of my reasons is because it is time efficient since patients have easy access to schedule appointments, request medications, or view their records or lab results. With this technology it is easier for a patient to schedule an appointment or request an appointment rather than calling the health center or having...

  • Can someone explain the graph to me I dont know how to read it to answer the questions

    can someone explain the graph to me I dont know how to read it to answer the questions Atomic radius Nbonding The radius of an atom describes the distance between the nucleus and the outermost electron. This distance is very small so it is often reported in picometers (101 m) or angstroms (10-10 m). One way of measuring the atomic radius is to observe the distanc between bonding atoms. The distance between the nuclei of the bonding atoms is equal...

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
ADVERTISEMENT