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
You are planning to implement dual stack of IPv4 and IPv6 in your network. Currently, your network consists of servers, routers,
AleksandrR [38]

Answer:

Ensuring that Internet Service Providers (ISPs) work with IPv6 .

Explanation:

An Internet Service Provider (ISP), it is the company that supply to other companies or an individuals for accessing the Internet and some other services such as virtual hosting and Web site building. ISP has the telecommunication line and an equipment to access the required point of area for the Internet.

4 0
3 years ago
Go to your Canvas course and locate the Assignment: Writing Prompt 1: Is the Internet making us Meaner?and complete the activity
Maslowich

Answer and Explanation:

The Internet is not changing anything other than making you extreme. The nice become nicer, the mean become meaner, the nice become mean, and the mean become nice. The internet just makes things easier to do. It really isn't a factor in if you are mean or not.

7 0
3 years ago
Read 2 more answers
Help me code plz i using python language on laptop please answer or comment if u want to help
dybincka [34]

Answer:

What is the question you have?

Explanation:

7 0
2 years ago
Technician A says that using 100% coolant is better for freeze protection in an engine than a mixture with water. Technician B s
Levart [38]

Answer:

Technician B is right.

Explanation:

Generally speaking, most engines use a mixture of 50/50 coolant and water.

This is ideal in places where the weather never gets too extreme, and temperatures rarely go below 0 degrees. Using 100% antifreeze or coolant in any engine is not recommended since this doesn't have the same ability as water to transfer heat to or from the engine. Antifreeze is used to lower the freezing point of water, and it is water itself that does the job of keeping engine temperatures safe.

4 0
3 years ago
Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two
Alexeev081 [22]

Answer:

In Python:

cprice= int(input("Current price: "))

lmonth= int(input("Last month's price: "))

print("This house is $"+str(cprice))

print("The change is $"+str(cprice-lmonth)+" since last month")

print("The current mortage $"+str((cprice * 0.051) / 12)+" since last month")

Explanation:

Get current price

cprice= int(input("Current price: "))

Get last month's price

lmonth= int(input("Last month's price: "))

Print the current price

print("This house is $"+str(cprice))

Print the change

print("The change is $"+str(cprice-lmonth)+" since last month")

Print the mortgage

print("The current mortage $"+str((cprice * 0.051) / 12)+" since last month")

8 0
3 years ago
Other questions:
  • Sam wants to move from his current role in his organization to a managerial role. Which certification will help him get on a man
    6·1 answer
  • Question / UJU
    11·1 answer
  • Look at the following HTML form. Which description is correct? Please enter your discount code:
    13·1 answer
  • Which of the following are good uses of a Microsoft Excel spreadsheet? charts payroll newsletters presentations budgets
    12·1 answer
  • What are some common security threats for our home devices and IoTs?
    14·1 answer
  • 18. When you turn off the power to a computer and unplug it at night, it loses the date, and you must reenter it each morning. W
    7·2 answers
  • Joan typed an entire page of her English essay. She is now at the bottom of her document and can’t see the top. What should Joan
    5·1 answer
  • Where do we manage POS? ​
    6·1 answer
  • All Office programs have similar commands on the tab for changing the document view a. File b. View c. Locate d. display ​
    5·1 answer
  • spreadsheet solution Credit Score Current Rate First Name: Mary 500 6.50% Last Name: Bell 550 6.25% Address: 123 First Street 60
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!