Answer:
a. Protected
b. Public
Explanation:
There are four acess modifier in Java.
Default: Acessible only within the same package.
Public: Can be acessed by any class.
Private: Acessible only within the class.
For example, you have a class employee and a private method. This method can only be accessed by an object that is an instance of an employee.
Protected: Used in classes that extend each other. For example, a class of employees would extend employee.
So:
a. A class Employee records the name, address, salary, and phone number.
The best acesses modifier is protected. A class may extended employee but have the same arguments(name, adress, salary, phone number), so it should also have acess to the method.
b. An adding method inside of a class BasicMath.
This method can be used in a variety of packages and projects and classes... and there is no important information regarding security. So the best method is public.
Answer:
To get the IP address and other information on the workstation, type 'ipconfig' for windows or 'ifconfig' or Linux and press the return key.
The subnet mask is a class B type and 169.254.14.11 IP address shows that the workstation cannot access the DHCP server, so the IP address is not properly configured for network connection.
Explanation:
A computer network is an interconnection and intercommunication of two or more computer devices. All devices in a network must have an IP address, which can be static or dynamic from a DHCP server.
When a computer is configured to receive IP address from a DHCP server, but cannot reach the server, the IP address from the range of 169 is automatically assigned to it but still would not be able to communicate with other devices in the network.
Answer:
#include <iostream>
using namespace std;
class Digits
{
public:
int num;
int read() //method to read num from user
{
cout<<"Enter number(>0)\n";
cin>>num;
return num;
}
int digit_count(int num) //method to count number of digits of num
{
int count=0;
while(num>0) //loop till num>0
{
num/=10;
count++; //counter which counts number of digits
}
return count;
}
int countDigits(int num) //method to return remainder
{
int c=digit_count(num); //calls method inside method
return num%c;
}
};
int main()
{
Digits d; //object of class Digits is created
int number=d.read(); //num is read from user
cout<<"\nRemainder is : "<<d.countDigits(number); //used to find remainder
return 0;
}
Output :
Enter number(>0)
343
Remainder is : 1
Explanation:
As program is missing to find errors , a logically write program is written to find the remainder when a number is divided by its number of digits. A class Digits is constructed which has public variable num and methods read(), digit_count(), countDigits().
- read() - This method reads value of num from the user and return num.
- digit_count() - This method takes a integer as parameter and counts the number of digits of a number passed as argument. while loop is used to increement the counter until num<0. This returns the value of count.
- countDigits() - This method takes a integer as a parameter and returns remainder when the argument is divided by number of digits of argument. Number of digits is calculated by using method digit_count().
At last in main method , object of Digits class is created and its methods are used to find the output.
Answer:
Array, pointers, struct, and union are the derived data types.
Leonardo da Vinci was a very famous painter. I would assume that he is an expert in painting.
Hope this helped