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
Paha777 [63]
3 years ago
8

If r is an instance of the above Person class and oddNum has been declared as a variable of type boolean, which of the following

correctly sets oddNum to true if Person object r has an odd number of children and to false otherwise?
oddNum = ( ( r.numChildren() % 2 ) != 0 );

if ( ( r.numChildren() % 2 ) == 0 )

oddNum = false;

else

oddNum = true;

oddNum = false;

for ( int k = 0 ; k < r.numChildren() ; k++ )

oddNum = !oddNum;

I only

II only

III only

I and II only

I, II, and III
Computers and Technology
1 answer:
cricket20 [7]3 years ago
4 0

Answer:

I, II, and III

Explanation:

The three are almost saying the same thing. the loop is one am a bit concerned about. but since the oddnum is set to false, the loop will work.

The one and two are pretty clear. to test for odd number, the easiest is to divide by two to see if there will be a remainder. That is what both first and second statement is trying to do.

You might be interested in
13. WHICH OF THE FOLLOWING IS INVOLVED IN CREATING A DOCUMENT? *
Pavlova-9 [17]

Answer:

All of the above

Explanation:

Hope this helps...

7 0
3 years ago
Assume you're using a three button mouse. To connect shortcut menus, you would what
Grace [21]
You would click the right button to a shortcuts

5 0
2 years ago
What is your opinion on gaming? do you think it has more positive or negative impacts
joja [24]

Answer:

positive bc you can learn from them wwhat to do what not to do mistakes that you wont make in. real life

4 0
2 years ago
Read 2 more answers
Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named depart
sweet [91]

Answer:

see explaination

Explanation:

class Employee

{

String name;

double salary;

void tostring()

{

System.out.println("Employee:\nName: "+name+"\nSalary: "+salary+"\n");

}

Employee(String n,double s)

{

name=n;

salary=s;

}

}

class Manager extends Employee

{

String department;

void tostring()

{

System.out.println("Manager:\nName: "+name+"\nDepartment: "+department+"\nSalary: "+salary+"\n");

}

Manager(String n,double s,String d)

{

super(n,s);

department=d;

}

}

class Executive extends Manager

{

void tostring()

{

System.out.println("Executive:\nName: "+name+"\nDepartment: "+department+"\nSalary: "+salary+"\n");

}

Executive(String n,double s,String d)

{

super(n,s,d);

}

}

public class test

{

public static void main(String args[])

{

Employee e =new Employee("Neo",12000);

e.tostring();

Manager m =new Manager("Cramster",100000,"Homework");

m.tostring();

Executive ex =new Executive("Chuks",1000000,"Homework");

ex.tostring();

}

}

8 0
3 years ago
How many iphones have Apple sold in 2019?
Phoenix [80]

Answer:

40.7 million iphones

Explanation:

Gupta. Apple's iPhone sales continued to decline in the third quarter of 2019. Apple sold 40.8 million iPhones, a year-over-year decline of 10.7%.

3 0
3 years ago
Read 2 more answers
Other questions:
  • According to your textbook, the three major criteria against which to test documents that you locate on the Internet are authors
    8·1 answer
  • You friends parents are worried about going over their budget for the month. Which expense would you suggest is NOT a need?
    10·1 answer
  • What so the term used to describe how many bits are used in each pixel?
    7·1 answer
  • Use the image above to determine which toolbars will be displayed in the program you are using. SELECT ALL THAT APPLY
    11·2 answers
  • . The toasting cycle of an automatic toaster is started by A. pushing the bread rack down. B. pushing the start button. C. turni
    14·2 answers
  • If you configure any more passwords on the switch, will they be displayed in the configuration file as plain text or in encrypte
    13·1 answer
  • There are varying definitions for the term "dumb terminal," but it often refers to the fact that the terminal has
    13·1 answer
  • A type of multiprocessor chip that provides two or more separate and independent CPUs.
    8·1 answer
  • You are a running cable in a new network. You are running a series of cables from the wiring closet to the RJ-45 ports for the c
    6·1 answer
  • What is the difference between Remote Assistance and Remote Desktop?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!