{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Comp 110 2nd midterm

Comp 110 2nd midterm - Comp 110 2nd midterm OMP 110 Spring...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Comp 110 2 nd midterm OMP 110, Spring 2008 Midterm Exam 2: Write a Program Due: Sunday April 27, 11:59 pm This exam/program is pledged. If you turn it in you will be implicitly signing a pledge that says you did the work on your own without assistance from your classmates or any other person. You may use your class notes and materials of course. You may also ask the instructor and TAs for clarification if you have questions or confusions. Write a Java program that will create and manipulate an array of double values in several different ways. You will have at least two classes. Let's call them MyProg and MyArray. Here are the details of what each class should do. 1 -- class MyArray This class will contain the array of double and will have several different methods for mapipulating that array: a) method "fill" will read double values from the keyboard and put them into the array. This method will have to do error checking to make sure the user is giving proper doubles. We will allow both positive and negative values in the array. b) method "sum" will find the total sum of all elements in the array
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
c) method "product" will compute and return the product of all elements in the array d) method "zero" will fill the array with 0.0 values. e) method "largest" will find and return the largest value in the array. f) method "smallest" will find and return the smallest value in the array. h) method "set" will take a double and an integer as argument, and put the double value into the array location indicated by the integer argument.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}