Arguments and return an array of doubles

Assignment Help Business Economics
Reference no: EM131457498

1. Write a complete Java program called CalcAvgDropLowest according to the following guidelines.

The program prompts the user for five to ten numbers, all on one line, and separated by spaces.  It then calculates the average of all those numbers except the lowest n number(s), where n is given by the user, and displays all the numbers and the calculated average to the user.

The program uses methods to:

1. Get the numbers used to calculate the average,

2. Get the number of lowest numbers to drop before calculating the average,

3. Calculate the average of the numbers (except the lowest n number(s)) entered by the user, and

4. Print the results.

The first method should take no arguments and return an array of doubles.

The second method should take no arguments and return a single integer, the number of the lowest numbers to drop before calculating the average.

The third method should take an array of doubles (the return value of the first method above) and a single integer value (the number of lowest items to drop before calculating the average) and return a double (the average of all the numbers except the lowest n values).

The fourth method should take an array of doubles, an integer, and a double as arguments but have no return value.

For example:

If the user gives these numbers for calculating the average:

40.00 60.00 80.00 100.00 20.00

...and the user gives the number 2 to indicate how many of the lowest values should be dropped before calculating the average, then...

...the program should give as output:

Given the numbers 40.00, 60.00, 80.00, 100.00, and 20.00, the average of all the numbers except the lowest 2 numbers is 80.00.

2. Write a complete Java program called MinMax that declares an array of doubles of length 5, and uses methods to populate the array with user input from the command line and to print out the max (highest) and min (lowest) values in the array.

3. Write a complete Java program called Scorer that declares a two-dimensional array of doubles (call it scores) with three rows and three columns and that uses methods and loops as follows:

  • Use a method containing a nested while loop to get the nine (3 x 3) doubles from the user at the command line.
  • Use a method containing a nested for loop to compute the average of the doubles in each row.
  • Use a method to output these three row averages to the command line.

Reference no: EM131457498

Questions Cloud

Discuss the process of defining project scope : Discuss the process of defining project scope in more detail as a project progresses, going from information in a project charter
What are the ports strategic goals : .Background information about the port: industry classification; markets, location, # of employees, products & services, suppliers, other pertinent information.
Why is corporate finance important to all managers : Why is corporate finance important to all managers and Describe the organizational forms a company might have as it evolves from a start-up to major corporation.
What is the rule of three : What is the rule of three? Suppose you worked for a small firm in a large industry-such as a small manufacturer of furniture. How might you actually use.
Arguments and return an array of doubles : The first method should take no arguments and return an array of doubles.
Describe the weaknesses of facebooks privacy policies : Describe the weaknesses of Facebook's privacy policies and features. What factors contributed to those weaknesses? Did Facebook overcome this issue?
Formulate a mission statement for the company : Choose one of the following companies, or select another one whose goods and services are familiar to you. On your own or with a classmate.
Explain why god may allow every single evil in the world : Start off explaining Mackie's argument against God's existence, and then summarize Plantinga's reply.
Topic in the relevant part of the course : For contribution, find an article, book, video, or website that relates to a topic in the relevant part of the course.

Reviews

Write a Review

Business Economics Questions & Answers

  Economics assignment

This document contains various important questions and their appropriate answers in the subject field of Economics.

  Demand and supply curves

Economics is the study of the principles governing the allocation of scarce means among competing ends when the objective of the allocation is to maximize the attainment of the ends.

  Long-run perfectly competitive equilibrium for the firm

Evaluate Government intervene and correct this situation?(a) Explain the concept of a concentration ratio. A rise in the price of magarine Explain the impact of external costs and external benefits on resource allocation long-run perfectly c..

  Supply and demand diagrams

Explain each of the following using supply and demand diagrams,  With the use of a graph, explain how these two programs affect cigarette consumption and the price of cigarettes.

  Case study: fisher-price toys

The case study of the Fisher-Price Toys, Inc., a popular case in basic economics and management from the prestigious Harvard Business School.

  Draw the production possibility curve

Draw the production possibility curve and a. Define consumer surplus and producer surplus.

  Tax revenue

The Australian government administers two programs that affect the market for cigarettes

  Maximize total welfare

How many tickets to sell to maximize total welfare.

  Difference between the cv and the ev

The change in consumer surplus (?CS) is not "theoretically" justifiable like the CV and EV but it continues to be the most widely used measure of consumer welfare change. Explain how this can be reconciled

  Depict von neumann-morgenstern utility index u in a diagram

Depict the von Neumann-Morgenstern utility index u in a diagram

  What is the market solution

What is the market solution (market price and quantity) and What is the total surplus of the society under the market solution

  Calculate gross national product and net national product

Calculate gross national product and net national product

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd