The Artima Developer Community
Sponsored Link

Java Answers Forum
Beginner needs help!

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Sapan Ganguly

Posts: 1
Nickname: sapg
Registered: Nov, 2002

Beginner needs help! Posted: Nov 28, 2002 6:10 PM
Reply to this message Reply
Advertisement
Can anyone help with this? The part that is the biggest problem is the addValue method as I do not know how to resize arrays. I think I have done the other parts successfully though. Your help would be much appreciated.


/*
Your task is to develop a class ExperimentData which holds int data values. The
class
has two constructors ExperimentData() which allocates an array of some default
size
and ExperimentData(int n) which allocates 'n' locations for the data.
You will also provide code for the method addValue(int value) which adds an int
to the data, a method findSum() which returns with the sum of the data and
findZeros()
which finds the total number of zeroes in the data. We have provided a class
Tester
which tests this class out. Use an array for the storage of the ints and do not
worry
about any errors
*/

public class ExperimentData {

//instance variables

public ExperimentData() {
//student code here
}

public ExperimentData(int n) {
//Student code here
}

public void addValue(int value){
//Student code here
}

public int findSum(){
//Student code here
}

public int findZeros(){
//Student code here
}
}

Topic: testing for null spaces Previous Topic   Next Topic Topic: Using an existing dll with Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use