Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ * * Average class * / public class Average { private double akkum; private int Count; public Average ( ) / / Constructor; initializes

/**
Average class
*/
public class Average
{
private double akkum;
private int Count;
public Average()// Constructor; initializes the class fields
{
akkum =0.0;
Count =0;
}
public void setSum(double num1)// Mutator Method (Setter)
{
akkum += num1; // This double field is accumulating the values of the numbers entered
}
public void setCount()// Mutator Method (Setter)
{
Count++; // This integer counts how many values have been read
}
public double getSum()// Accessor Method (Getter)
{
return akkum; // This double value represents the sum of all the numbers to be averaged
}
public int getCount()// Accessor Method (Getter)
{
return Count; // This integer value represents how many numbers have been entered
}
public double getAvg()// Accessor Method (Getter)
{
return akkum / Count; // This double value represents the calculated Average; prevents stale data
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

What are the advantages and disadvantages of inflation

Answered: 1 week ago

Question

Write short notes on Interviews.

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago