1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Softa [21]
3 years ago
6

Write a full class definition for a class named Averager, and containing the following members:______An data member named sum of

type integer.An data member named count of type integer.A constructor with no parameters. Theconstructor initializes the data members sum and the data member count to 0.A function named getSum that accepts noparameters and returns an integer. getSumreturns the value of sum.A function named add that accepts an integer parameter and returns no value. add increases the value of sum by the value of theparameter, and increments the value of countby one.A function named getCount that accepts noparameters and returns an integer. getCountreturns the value of the count data member, that is, the number of values added to sum.A function named getAverage that accepts noparameters and returns a double. getAveragereturns the average of the values added to sum. The value returned should be a value of type double (and therefore you must cast the data members to double prior to performing the division).
Computers and Technology
2 answers:
alina1380 [7]3 years ago
6 0

Answer:

  1. public class Averager {
  2.    private int sum;
  3.    private int count;
  4.    public Averager(int sum, int count) {
  5.        this.sum = 0;
  6.        this.count = 0;
  7.    }
  8.    public int getSum(){
  9.        return sum;
  10.    }
  11.    public void add( int num){
  12.        this.sum+=num;
  13.        this.count++;
  14.    }
  15.    public int getCount(){
  16.        return this.count;
  17.    }
  18.    public double getAverage(){
  19.        double ave = (int)this.sum/this.count;
  20.        return  ave;
  21.    }
  22. }

Explanation:

  • Lines 1-3 contains the class declaration and the member (data fields)
  • Lines 4-7 is the constructor that initializes the fields to 0
  • Lines 8-10 is the method that returns the value of sum getSum()
  • lines 11-14 iss the method add() that adds a number to the member field sum and increases count by 1
  • lines 15 - 17 is the method that returns total count getCount()
  • Lines 18-21 is the method getAverage() That computes the average and returns a double representing the average values

balandron [24]3 years ago
3 0

Answer:

#ifndef AVERAGER

#define AVERAGER

class Averager{

public:

int sum;

int count;

Averager(){

sum = 0;

count = 0;

}

int getSum(){

return sum;

}

void add(int n){

sum += n;

count++;

}

int getCount(){

return count;

}

double getAverage(){

return (double)sum/count;

}

};

#endif

Explanation:

You might be interested in
What happens to testosterone levels of those who lose chess tournaments?
Norma-Jean [14]

Answer:they go below an unhealthy level

Explanation:

6 0
2 years ago
The term _____ best describes the level of technology skills needed in today’s business world.
laiz [17]
The answer is fluency.
4 0
2 years ago
What type of software resides on a computer’s hard drive, and controls the CPU and all other activity between components?
myrzilka [38]
Operating System  (OS) is the answer.

An application runs in/on an OS.  It is not the OS itself. Like Word or Chrome are applications. 

Systems is too generic and not specific enough to mean anything in this context.  Throw away answer.

Network Operating System does not 'usually' run on a hard drive but on memory chips in things like routers, wireless access points and switches that move network traffic.


3 0
3 years ago
The following problem illustrates the way memory aliasing can cause unexpected program behavior. Consider the following function
laila [671]

Answer:

A

Explanation:

The value will be the original stored in the int variables. This is because the method swap(int xp, int yp) accepts xp and yp parameters by value (They are passed by value and not by reference). Consider the implementation below:

public class Agbas {

   public static void main(String[] args) {

   int xp = 2;

   int yp = xp;

   swap(xp,yp); //will swap and print the same values

       System.out.println(xp+", "+yp); // prints the original in values 2,2

 int xp = 2;

   int yp = 5;

   swap(xp,yp); // will swap and print 5,2

       System.out.println(xp+", "+yp); // prints the original in values 2,5

   }

   public static void swap(int xp, int yp){

       int temp = xp;

       xp = yp;

       yp = temp;

       System.out.println(xp+", "+yp);

   }

}

5 0
3 years ago
Jason is working on a video image. He wants to add a small blur effect in a part of the video, but does not want to damage the v
romanna [79]
<span> Jason can use the filter tool to edit while maintaining the original content of the file.</span>
6 0
3 years ago
Other questions:
  • Antivirus software products require that you update _____ on a regular basis
    6·2 answers
  • Do most facebook and twitter users access the platform from their personal computers?
    6·2 answers
  • you just bought a new hard drive for your computer you plan to use this as a second hard drive to store all your you made files
    6·1 answer
  • If you have machines doing jobs, fewer staff are needed, therefore costs are
    5·2 answers
  • The CSS property of top , bottom , left , or right moves the element the specified distance from the respective edge of the clos
    7·1 answer
  • Rachael has been posting negative comments on several of her peers' social media pages. Which of the six Ps is Rachael abusing?
    15·1 answer
  • When changing lanes on an expressway signal your intentions and?
    8·1 answer
  • Which of the following is true of Chinese Opera: Two opera centers emerged Beijing and Yangzhou 300-400 forms of opera arose in
    10·1 answer
  • Research the topic of legal and ethical behaviors or dilemmas related to technology. Identify five topics of concern and briefly
    9·1 answer
  • What is the model for 2017 Ford Mustang v6
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!