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
What benefit does internet have​
Licemer1 [7]
Information can be transferred and passed way easier.
5 0
3 years ago
Class 10 computer unit 1 all excersise​
kenny6666 [7]
Y’all just asking for people do your work, literally not even a question
5 0
3 years ago
What is the FICO system?
Serhud [2]
It is C) A credit investment system.
8 0
3 years ago
Which of the following code correctly registers a handler with a button btOK?a. btOK.setOnAction(e -&gt; System.out.println("Han
Bad White [126]

Answer:

The correct answer is C:

btOK.setOnAction((ActionEvent e) -> System.out.println("Handle the event"));

Explanation:

The button produces an action once clicked. The setOnAction method indicates what will happen when the button is clicked. Action Event is a type of event that gets processed by EventHandler, which provides the action to be performed by clicking the button (printing out "Handle the event").

4 0
3 years ago
Business customers pay $0.006 per gallon for the first 8000 gallons. If the usage is more than 8000 gallons, the rate will be $0
trasher [3.6K]

Answer:

#include <bits/stdc++.h>

using namespace std;

int main()

{

   // variables

   char cust_t;

   int no_gallon;

   double cost=0;

   cout<<"Enter the type of customer(B for business or R for residential):";

   // read the type of customer

   cin>>cust_t;

   // if type is business

   if(cust_t=='b'||cust_t=='B')

   {

       cout<<"please enter the number of gallons:";

       // read the number of gallons

       cin>>no_gallon;

       // if number of gallons are less or equal to 8000

       if(no_gallon<=8000)

       {

           // calculate cost

           cost=no_gallon*0.006;

           cout<<"total cost is: $"<<cost<<endl;

       }

       else

       {

           // if number of gallons is greater than 8000

           // calculate cost

           cost=(8000*0.006)+((no_gallon-8000)*0.008);

           cout<<"total cost is: $"<<cost<<endl;

           

       }

       

   }

   

   // if customer type is residential

   else if(cust_t=='r'||cust_t=='R')

        {

           

       cout<<"please enter the number of gallons:";

       // read the number of gallons

       cin>>no_gallon;

       // if number of gallons are less or equal to 8000

       if(no_gallon<=8000)

       {

           // calculate cost

           cost=no_gallon*0.007;

           cout<<"total cost is: $"<<cost<<endl;

       }

       else

       {// if number of gallons is greater than 8000

       // calculate cost

           cost=(8000*0.005)+((no_gallon-8000)*0.007);

           cout<<"total cost is: $"<<cost<<endl;      

       }        

   }

return 0;

}

Explanation:

Ask user to enter the type of customer and assign it to variable "cust_t". If the customer type is business then read the number of gallons from user and assign it to variable "no_gallon". Then calculate cost of gallons, if  gallons are less or equal to 800 then multiply it with 0.006.And if gallons are greater than 8000, cost for  first 8000 will be multiply by 0.006 and  for rest gallons multiply with 0.008.Similarly if customer type is residential then for first 8000 gallons cost will be multiply by 0.005 and for rest it will  multiply by 0.007. Then print the cost.

Output:

Enter the type of customer(B for business or R for residential):b                                                                                            

please enter the number of gallons:9000                                                                                                                      

total cost is: $56  

4 0
3 years ago
Other questions:
  • It is generally safe to provide your social security number to
    7·2 answers
  • Suppose you were assigned to develop a logical model of the registration system at a school or college. would you be better off
    9·1 answer
  • How do you uninstall sc update?
    13·2 answers
  • All linear programming problems have all of the following properties EXCEPT
    9·2 answers
  • Which type of microphone uses two metal plates?
    7·1 answer
  • Which of the following is true regarding a class and interface types? Group of answer choices You can convert from a class type
    9·1 answer
  • What does resolution mean on a computer monitor?
    9·2 answers
  • Where does the list of incoming mail appear in gmail
    13·2 answers
  • Tech A says that gasoline vapors are lighter than air, so inspection pits do not have a fire hazard like above ground hoists. Te
    9·1 answer
  • Define technical writing. The proposal introduces the ……. (5 Mark)
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!