Prompt a user to enter data for an array

Assignment Help Computer Engineering
Reference no: EM132210493

Write a program that prompts a user to enter data for an array. The user should be able to input ANY primitive data type (int, float, double, long). The program should also have the following methods:

getTotal. This method should accept a one-dimensional array as its argument and return the total of the values in the array.

GetAverage. This method should accept a one-dimensional array as its argument and return the average of the values in the array.

GetHighest. This method should accept a one-dimensional array as its argument and return the highest of the values in the array.

GetLowest. This method should accept a one-dimensional array as its argument and return the lowest of the values in the array.

Example input and output

Enter Data Type: INT (Enter -999 to stop)

Enter Integers: (Enter -999 to stop) 2

Enter Integer: 3

Enter Integer: 4

Enter Integer: 5

Enter Integer: -999

Processing the int array.

Total : 14

Average : 4

Highest value : 5

Lowest value : 2

Enter Data Type: DOUBLE (Enter -999 to stop)

Enter Double: (Enter -999 to stop) 2.5

Enter Double: 2.4

Enter Double: 2.3

Enter Double: 2.2

Enter Double: -999

Processing the Double array.

Total : 9.4

Average : 2.35

Highest value : 2.5

Lowest value : 2.2

Reference no: EM132210493

Questions Cloud

Describe how that change will affect the numerator : For each of those ways, describe how that change will affect the numerator and the denominator of formula used to compute the risk adjusted return on capital
Perform multiple die rolls using a random number generator : Write a program that performs multiple die rolls using a random number generator.
Write a program to process this student data : Write a program to process this student data. First, input these records into a record structure.
Discuss what you feel are minimum top three elements of art : Choose a photograph from the Professional Artist's website given below. Describe the photo and discuss what you feel are minimum top three elements of art.
Prompt a user to enter data for an array : getTotal. This method should accept a one-dimensional array as its argument and return the total of the values in the array.
Prepare consolidation worksheet entries for december : What is the consolidated balance for the Equipment account as of December 31, 2012 - Prepare consolidation worksheet entries for December 31, 2011, and December
Determine the number and type of variables : Write a program that prompts the user to enter a decimal number and then outputs this number rounded to two decimal places.
Write about two artworks from the periods : For this essay, write about two artworks from the periods we read about in Unit VII: Renaissance, Baroque, Impressionist, or Post-Impressionist periods.
Write a program to play the pig game against the computer : Write a program to play the pig game against the computer. At each turn, the current player will roll a pair of dice and accumulates points.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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