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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:20, karreemgrant2
What is the full meaning of rfid in computer
Answers: 2
image
Computers and Technology, 23.06.2019 15:00, ryleerose255
Idon’t understand the double8 coding problem. it is java
Answers: 1
image
Computers and Technology, 23.06.2019 20:00, shadow6728g
How much current flows through the alternator brushes? a. 2–5 a b. 25–35 a, depending on the vehicle c. 5–10 a d. 10–15 a
Answers: 2
image
Computers and Technology, 24.06.2019 13:20, sanaiajohnson56
In the insert table dialog box, you select the checkbox to create the first row as the header of the table.
Answers: 3
You know the right answer?
Write a class averagecalculator. the purpose of a averagecalculator object is to count, sum and aver...

Questions in other subjects: