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
Compare and contrast CD and DVD?
anzhelika [568]

Answer:

Both Flat, round discs.

A DVD can hold six times as much as compacity than a disc.

A CD is a Compact Disc.

4 0
2 years ago
Read 2 more answers
Create an array of numbers filled by the random number generator. (value = (int)(Math.random() * 100 + 1);) Print the array and
Y_Kistochka [10]

Answer:

Explanation:

the following is the code to run this (JAVA)

MeanStandardDev.java

import java.util.Random;

import java.util.Scanner;

public class MeanStandardDev {

public static void main(String[] args) {

// Declaring variables

int N;

double lower, upper, min, max, mean, stdDev;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

// Getting the input entered by the user

System.out.print(" How many Random Numbers you want to generate :");

N = sc.nextInt();

System.out.print("Enter the Lower Limit in the Range :");

lower = sc.nextDouble();

System.out.print("Enter the Upper Limit in the Range :");

upper = sc.nextDouble();

// Creating Random class object

Random rand = new Random();

double nos[] = new double[N];

// this loop generates and populates 10 random numbers into an array

for (int i = 0; i < nos.length; i++) {

nos[i] = lower + (upper - lower) * rand.nextDouble();

}

//calling the methods

min = findMinimum(nos);

max = findMaximum(nos);

mean = calMean(nos);

stdDev = calStandardDev(nos, mean);

//Displaying the output

System.out.printf("The Minimum Number is :%.1f\n",min);

System.out.printf("The Maximum Number is :%.1f\n",max);

System.out.printf("The Mean is :%.2f\n",mean);

System.out.printf("The Standard Deviation is :%.2f\n",stdDev);

}

//This method will calculate the standard deviation

private static double calStandardDev(double[] nos, double mean) {

//Declaring local variables

double standard_deviation=0.0,variance=0.0,sum_of_squares=0.0;

/* This loop Calculating the sum of

* square of eeach element in the array

*/

for(int i=0;i<nos.length;i++)

{

/* Calculating the sum of square of

* each element in the array    

*/

sum_of_squares+=Math.pow((nos[i]-mean),2);

}

//calculating the variance of an array

variance=((double)sum_of_squares/(nos.length-1));

//calculating the standard deviation of an array

standard_deviation=Math.sqrt(variance);

return standard_deviation;

}

//This method will calculate the mean

private static double calMean(double[] nos) {

double mean = 0.0, tot = 0.0;

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Calculating the sum of all the elements in the array

tot += nos[i];

}

mean = tot / nos.length;

return mean;

}

//This method will find the Minimum element in the array

private static double findMinimum(double[] nos) {

double min = nos[0];

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Finding minimum element

if (nos[i] < min)

min = nos[i];

}

return min;

}

//This method will find the Maximum element in the array

private static double findMaximum(double[] nos) {

double max = nos[0];

// This for loop will find the minimum and maximum of an array

for (int i = 0; i < nos.length; i++) {

// Finding minimum element

if (nos[i] > max)

max = nos[i];

}

return max;

}

}

the OUTPUT should give;

How many Random Numbers you want to generate :10

Enter the Lower Limit in the Range :1.0

Enter the Upper Limit in the Range :10.0

The Minimum Number is :1.1

The Maximum Number is :9.9

The Mean is :6.30

The Standard Deviation is :2.98

cheers i hope this helps!!!

4 0
3 years ago
Select all that apply. Two physical things you can do to demonstrate you are paying attention to a speaker are _____ and _____.
omeli [17]
B and d ............
7 0
3 years ago
Read 2 more answers
The physical components of a computer, such as a keyboard or hard drive, is called?
faust18 [17]

I'm assuming hardware.


Remember, Hard = Physical.


If that's not it, try peripherals.

4 0
3 years ago
When a cardholder successfully contests a charge, the acquiring bank must retrieve the money it placed in the merchant account i
lions [1.4K]

Answer:

Charge back.

Explanation:

A chargeback is a charge that is returned to a payment card after a customer successfully disputes an item on their account transactions report. Simply put, it is the reversal of a credit card payment that comes directly from the bank.

Most commonly the payer is a consumer.

A chargeback may occur on bank accounts or credit cards. They can be granted to a cardholder for a variety of reasons. A chargeback can be considered a refund since it returns specified funds taken from an account through a prior purchase. Chargebacks are focused on charges that have been fully processed and settled. Chargebacks can often take several days for full settlement as they must be reversed through an electronic process involving multiple entities.

The chargeback is ordered by the bank that issued the consumer's payment card.

6 0
2 years ago
Other questions:
  • which one of these steps describe saving a newly created file. click on the save icon. minimize the file. name the file. select
    12·2 answers
  • This term describes two or more arrays that hold related data, and the related elements in each array are accessed with a common
    15·1 answer
  • A _____ is a unique name that identifies an Internet site. URL Browser AOL IA
    13·1 answer
  • Text can be easily moved from one location to another using _____.
    15·1 answer
  • Free 35 points!!!
    11·2 answers
  • 14. Which of the following information about the ESRT T-teen rating rating is FALSE?
    15·1 answer
  • Help plz,l didn’t pay attention in class
    7·1 answer
  • What are general purpose computer and special purpose computer?​
    10·2 answers
  • Which two features offered by SharePoint
    12·1 answer
  • an existing technology that would allow users to transfer images from the camera to the computer without connecting them
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!