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
olga55 [171]
4 years ago
10

Consider a Rational class designed to represent rational numbers as a pair of ints, along with methods reduce (to reduce the rat

ional to simplest form), gcd (to find the greatest common divisor of two ints), as well as methods for addition, subtraction, multiplication, and division. Why should the reduce and gcd methods be declared to be private?
A. because they will never be used
B. because they will only be called from methods inside Rational
C. because they will only be called from the constructor of Rational
D. because they do not use any of the Rationalinstance data
E. This is incorrect; they should be declared as public
Computers and Technology
1 answer:
emmasim [6.3K]4 years ago
3 0

Answer:

Option B is the correct answer to the following question.

Explanation:

Because the data members and the member functions are declared with the private access modifier so they are unable to access from outside the class even they are the data members or the member functions. then, all the members of the class can only call through the other method of relational then, they has to be declared with the private access modifier.

You might be interested in
What TYPE of flash drive is called when it saves your files safely? I'm going to use my friend computer that's why.
Lilit [14]

Answer:

A good Universal serial bus i use is a San Disk

Explanation:

others are a WD easystore, A samsung MUF-BA.... etc

8 0
3 years ago
Write a function named "isValidPassword" that takes in a string and returns 1 if it stores a valid password and 0 otherwise, A v
Maslowich

Answer:

Here is code in java.

import java.util.*;

import java.lang.*;

import java.io.*;

class Solution

{

public static void main (String[] args) throws java.lang.Exception

{

   try{

   //declare and initialize string variables

       String str1="password";

       String str2="Pass_word";

    //calling function to check valid password

       System.out.println("output of password is: "+isValidPassword(str1));

        System.out.println("output of Pass_word is: "+isValidPassword(str2));

   }catch(Exception ex){

       return;}

}

// functionn to check the valid password

public  static int isValidPassword(String str)

{

// variables to count the lower,upper and non character

  int i, lower_c = 0, upper_c = 0, non_c = 0;

  char ch;

  for(i=0;i<str.length();i++)

  {

      ch = str.charAt(i);

     if(ch >= 'a' && ch <= 'z')

     {//count of lower character

        lower_c++;

     }

     else if(ch >= 'A' && ch <= 'Z')

     {

   //count of upper character

        upper_c++;

     }

     else

     {

   //count of non character

        non_c++;

     }

  }

  if(lower_c > 0 && upper_c > 0 && non_c > 0) {

     return 1;

  } else {

     return 0;

  }

}

}

Explanation:

Declare and initialize two string variables.In the isValidPassword() function, pass the string parameter and then count the lower, upper and non character in the string.If string contains call the three characters then function will return 1 otherwise it will return 0 .

Output:

output of password is: 0

output of Pass_word is: 1

8 0
4 years ago
How to change my ip address
Ostrovityanka [42]

you can use a vpn (virtual proxy network) that is the easiest way and the fastest

8 0
4 years ago
Read 2 more answers
Nathan wants to use the Push transition from left to right in his presentation. After he selects the Push transition, what shoul
Vladimir [108]

After he selects the Push transition, He should select from Left option from the Effect Options drop-down menu.

<h3>What is push transition in PowerPoint?</h3>

The Push Transition Effect is known to be a function in a PowerPoint that helps to pushes one slide to show the other.

Note that when this is  applied to any presentation, it moves the current slide upwards to reveal the next slide and so on. A person can add use this kind of effect to present a scrolling effect to one's PowerPoint work.

Learn more about presentation from

brainly.com/question/24653274

8 0
2 years ago
Read 2 more answers
You want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you shoul
nikklg [1K]

If you want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you should type chmod a <u>t  <subdir>.</u>

<h3>What is Subdir?</h3>

The Definition of the term subdirectory is known to be a kind of an organizational directory that can be seen on a computer.

It is known to be one that can be found inside another directory  such as a subfolder. It is seen as the file a person is looking for and it is one that needs to have an extension.

Therefore, if you want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. to do so, you should type chmod a <u>t  <subdir>.</u>

Learn more about directory from

brainly.com/question/14845522

#SPJ1

See full question below

You want to set the sticky bit on an existing directory, subdir, without otherwise altering its permissions. To do so, you should type:

chmod a+_____ <subdir>

- s

- p

- b

- t

6 0
2 years ago
Other questions:
  • What is the operating system?
    9·1 answer
  • Explain in detail what it means to synchronize computers and mobile devices. include at least two strategies for keeping your fi
    7·1 answer
  • What describes the basic transaction data such as its date, purpose, and amount and includes cash receipts, canceled checks, inv
    13·1 answer
  • What is the relationship between ionic bonds and cleavage
    13·1 answer
  • You are given two int variables j and k, an int array zipcodeList that has been declared and initialized, an int variable nZips
    10·2 answers
  • 1. Itemise the order in which BASIC executes arithmetic operation.
    13·1 answer
  • 1.What is the term referring to an amount of money that is owed?
    6·2 answers
  • What is Japanese tradition?
    8·2 answers
  • The math function ceil(x) returns the smallest integer that is greater than or equal to x. True False
    12·1 answer
  • Describe a new career in computer science that may be created in the future
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!