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, 24.06.2019 03:00
Click the "draw structure" button to activate the drawing utility. draw two diastereomers of (1z,4r)−1,4−dimethylcyclodecene and name them, including (e)/(z) and (r)/(s) notation. part 1 out of 4 draw the diastereomer containing a chiral center with s configuration here. window open
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
Consider jasper’s balance sheet. which shows how to calculate jasper’s net worth?
Answers: 1
question
Computers and Technology, 25.06.2019 01:20
Jason typically uses the internet to buy various items. it the total cost of all of the items ordered, at one time, is $250 or more, then the shipping and handling is free, otherwise the shipping and handling is $15 per item. design an algorithm that prompts jason to enter the number of items ordered and the price of each item. (remember cost = number of items order times price) the algorithm then outputs the total billing amount including shipping and handling. your algorithm must use a loop (repetition structure) to get the number and price of each item. write this in algorithm format not program code format.
Answers: 2
question
Computers and Technology, 25.06.2019 05:00
Which of the following statements best deceive the relationship between carrying capacity and population size
Answers: 1
You know the right answer?
Write a class averagecalculator. the purpose of a averagecalculator object is to count, sum and aver...
Questions
question
Chemistry, 01.07.2020 15:01
Questions on the website: 13722367