Answer:
The answer to this question can be given as:
Class definition:
public class Averager //define class Average.
{
private int sum = 0;
//define variable sum.
private int count = 0;
//define variable count.
public int getSum() //define function getSum().
{
return sum; //return value.
}
public void add(int x)
//define function add().
{
sum = sum + x; //calculate sum
count=count+1; //increase value of count.
}
public int add(int x)
//define function add().
{
return count; //return value.
}
public double getAverage() //define function getAverage().
{
return (double)sum/count; //return value
}
}
Explanation:
The above class definition can be described as:
- In the above class definition first we define a class that is " Averager". In this class we define two integer variable that is "sum and count" and assign a value that is 0. Then we define a functions :
- First we define getSum() function in this function we does not pass any value and the return type of this function is int that will return an integer value.
- Then we define add() function we use this function two times but both functions have different from each other.
- In first time implementation, we define this function and the return type of this function is void which means it does not return any value. In this function, we calculate the sum value and increase the value of the count variable by 1.
- In second time implementation, we define this function and the return type of this function is int which means it will return a value. In this function, we will return the count variable value.
- At the last, we define a getAverage() that calculates the average of the added values in the sum variable and returns its value.
Answer:
D. A & C
Explanation:
In an inheritance situation, the new class that you create from an existing class is known as the derived class or child class. The class that the child class inherits from is called the parent class. Child class or derived class has access to all the public and protected fields and methods in the parent class. The child class in effect is extending the implementation of the parent class with additional functionality.
Answer:b)Reserve Room, Enter Contact Information, Enter Reservation Detail
Explanation: The use case is described as actors , actors goal, usage of use cases, units of scope and initial point and terminating point of use cases .
The situation mentioned in the question will take place for the reservation of the room through the instances in the form like filling the contact details for the identification , filling out reservation information as well for getting the knowledge about the room requirement by the person.
These details help in reaching out the particular person if required, number of days he wants to book the room,any extra facility he would like to have etc. After these detail filling activity the room can be reserved successfully.Thus , the most appropriate option is option (b).
Other options are incorrect because room reservation cannot be done without any formality as mentioned in the question and entering contact detail and reservation detail one by one.
Answer:
<em>The programming language is not stated; However, I'll answer this question using 2 programming languages (Python and C++)</em>
<em></em>
<em>Comments are used for explanatory purpose </em>
Python program starts here
def get_my_age(): #Declare function
age = 21 #Assign value to age
print(age) #Print age
get_my_age() #Call function
#End of Program
C++ Programming Language starts here
#include<iostream>
using namespace std;
int get_my_age() //Declare Function
{
int age = 21; //Assign value to age
cout<<age; //Print age
}
int main()
{
get_my_age(); //Call Function
return 0;
}
Answer:
camera operators
directors of photography
Explanation:
Cinematography is simply the art of taking photos and being in charge of cameras in the process of film-making.
There are alternative names for a cinematographer and they include camera operators and directors of photography