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
Ksenya-84 [330]
3 years ago
15

Consider a Rational class designed to represent rational numbers as a pair of int's, along with methods reduce (to reduce the ra

tional to simplest form), gcd (to find the greatest common divisor of two int's), as well as methods for addition, subtraction, multiplication, and division. Why should the reduce and gcd methods be declared to be private.
Computers and Technology
1 answer:
Shtirlitz [24]3 years ago
8 0

Answer:

There is not a reason for the two methods to be private unless you want to only allow objects of the class Rational to have access to these methods.  Perhaps your professor has a particular reason for requiring it to be set up as such.

Explanation:

The use of the private space simply restricts access to either variables or methods contained within the space to the class object that is associated with the variable or methods.

The use of the public space allows the method or variable to be accessed from anywhere within the program.

Note, if using class inheritance, classes that inherit from the Rational class will not be able to access the private functions.

You might be interested in
Write an expression that whose value is the fifth character of the string name.
Anuta_ua [19.1K]
Int j;
j="name"[4];
//   you   could  do
j=0;   //  since name   has four letters  the fifth  character is the terminating 0
now  if the string  name is  name
you   could do
j=name[4];  // or even    4[name] 

5 0
3 years ago
The probability that the price of a commodity is increasing is 0.62 and the probability that the price is decreasing is 0.18 . W
liraira [26]

bahug ka itlog hduxuwlowv heusuowjdd

8 0
3 years ago
How do I change the keyboard light colors on Alienware 17 R5?
aleksandrvk [35]

Answer:

5 Launch the Alienware Control Center Press FN + F4 Launches the Alienware Control Center and opens the Theme Manager tab. Keyboard- backlight adjustment Press FN + F5 Press FN + F6 FN + F5 decreases the keyboard-backlight intensity. FN + F6 increases the keyboard-backlight intensity.

Explanation:

Nice Durango

3 0
3 years ago
A network administrator enters the service password-encryption command into the configuration mode of a router. What does this c
Ad libitum [116K]

Answer:

A network administrator enters the service password-encryption command into the configuration mode of a router. What does this command accomplish? This command prevents someone from viewing the running configuration passwords. You just studied 28 terms!

3 0
3 years ago
The process of engineering design typically starts with what ?
klemol [59]

The process of engineering typically starts with brainstorming.
6 0
3 years ago
Other questions:
  • One of the network printers is producing copies where the toner is smeared on paper after printing. What component should be che
    11·1 answer
  • __________bits equal one byte.EightTenSixty-fourThirty-twoSix
    10·1 answer
  • What is pure carbon made of
    14·2 answers
  • You suspect that an attacker has hidden files on your machine. What Linux command would you use to search for files with a file
    14·1 answer
  • Passwords are usually alphanumeric and usually cannot contain spaces or ________.
    10·2 answers
  • C. Compare Mainframe and Minicomputers with their key features<br><br><br><br>plzzz help ​
    12·1 answer
  • What are 3 software programs for mobile computing?
    10·1 answer
  • Final one bit l y links are a virus that will corrupt your files do not go on it
    15·2 answers
  • Who is known as the first computer programmer?​
    13·1 answer
  • What does it mean that the right mouse button is context-sensitive?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!