subject

Write a class averagecalculator. the purpose of a averagecalculator object is to count, sum and average a series of numbers. the averagecalculator class has the following specification:

instance variable of type int for the running sum of numbers that have been given to the averagecalculator
instance variable of type int for the count of numbers that have been given to the averagecalculator

no argument constructor
averagecalculator ()

a mutator method to add a number to the averagecalculator
void add(int newnum)

an accessor method to return the sum of all the numbers added to the averagecalculator
int getsum()

an accessor method to return the count, or number, of numbers added to the averagecalculator
int getcount()

an accessor method to return the average of all the numbers added to the averagecalculator
note that the instance variables are int, and the return type of this method is double--be careful with the division operation.
if no numbers have been added to the averagecalculator object, return 0.
double getaverage()

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:50
You have written, as part of a school assignment, a research paper on the solar system. you want to share this paper on your school website. on which type of server will you upload it?
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
How is the number 372 written when expanded out to place values in the base 8 (octal) number system? a. 2 x 4 + 3 x 2 + 4 x 1 b. 3 x 64 + 7 x 8 + 2 x 1 c. 3 x 8 + 7 x 7 + 2 x 6 d. 3 x 100 + 7 x 10 + 2 x 1
Answers: 1
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
You know the right answer?
Write a class averagecalculator. the purpose of a averagecalculator object is to count, sum and aver...
Questions
question
Mathematics, 16.10.2019 06:30
question
Advanced Placement (AP), 16.10.2019 06:30
Questions on the website: 13722363