Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 6: Arrays Write a class Summer that gets a list of floating point numbers as its command line arguments. For example, the user might

Assignment 6: Arrays

Write a class Summer that gets a list of floating point numbers as its command line arguments. For example, the user might type

 java Summer 1.3 435.78 -22.7 88

The class will read the numbers and print their sum. The class should implement and use a method

 double sum(double[] values)

Note that the method sum should not do any printing.

Write a similar class that gets a set of Strings from the command line. Store the Strings in an array. Implement a method reverse() that will reverse the elements of an array, and use it to show the reversed array.

Note: on #2: We want the method reverse to have this signature:

 void reverse(String[] strings)

That is, the reverse method will reverse the values in the array, but does not itself return a value. The easiest way to do that is to copy the values parameter to another local array (but in reverse) and then copy back onto the original array. A more efficient and sophisticated way to do it is to figure out how to rearrange the values in the array without creating a second arraythat is the bonus version of the problem.

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_2

Step: 3

blur-text-image_3

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

Question Can plan participants borrow from a VEBA?

Answered: 1 week ago

Question

Question What is an educational benefit trust and how is it used?

Answered: 1 week ago