Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago