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
Anna007 [38]
3 years ago
6

Determine the best access modifier for each of the following situations: a. A class Employee records the name, address, salary,

and phone number. b. An adding method inside of a class BasicMath.
Computers and Technology
1 answer:
Lorico [155]3 years ago
4 0

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.

You might be interested in
How many bits would be needed to count all of the students in class today?There are 25 in class
monitta

Answer:

50?

Explanation:

8 0
3 years ago
Read 2 more answers
By Definition, a Small Business?
Strike441 [17]

Answer:

A small business is a privately owned and operated business. A small business typically has a small number of employees.

Hope this helped you!

Explanation:

4 0
3 years ago
Def pig_latin(word): """ ------------------------------------------------------- Converts a word to Pig Latin. The conversion is
Virty [35]

def pig_latin(word):

   if word[0].lower() in 'aeiou':

       word = word + 'way'

   else:

       t=''

       for x in range(len(word)):

           if word[x].lower() in 'aeiou':

               break

           if word[x].lower() == 'y' and x>0:

               break

           else:

               t+=word[x].lower()

       if word[0].isupper():

           word = word[len(t):]+word[:len(t)].lower()+'ay'

           word = word.title()

       else:

           word = word[len(t):]+word[:len(t)].lower()+'ay'

   return word

word = 'test'

pl = pig_latin(word)

print(pl)

I wrote my code in python 3.8. I hope this helps.

5 0
3 years ago
If all humans started from one tiny cell why do you think we all look and act differently
scZoUnD [109]
The one cell evolved into different categories by adapting to its human/animal/plant’s habitat
3 0
3 years ago
To inspire unit 1 App
Tasya [4]
Is there more to this or ?
5 0
2 years ago
Other questions:
  • The mathematical order of operations is used in Excel when formulas are evaluated. This order of operations states the order to
    9·2 answers
  • A/An ___ is a series of instructions or commands that computer follows used to create software
    10·2 answers
  • If you wanted to create a graph that showed how much each value contributed to the whole value, you would use a _____.
    15·2 answers
  • To configure a router / modem, what type of IP interface configuration should you apply to the computer you are using?
    8·1 answer
  • What may happen if there is too much harmony in a design?
    14·1 answer
  • Ideally an entity identifier is composed of _____ attribute(s).
    11·1 answer
  • FRee points just put something
    14·2 answers
  • PLS PAK I ANSWER NITO KAILANGAN LANGPO​
    6·1 answer
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
  • Write a two to three sentence response to the following question:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!