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
Allushta [10]
3 years ago
13

Create a public class Dog that stores a single double age set by the constructor. (Reject negative ages using assert.) Dog shoul

d also provide a single class method named isOlder. isOrder should accept two Dog instances and return true if the first is older than the second, and false otherwise. You should also assert that both passed instances are not null.
Computers and Technology
1 answer:
hjlf3 years ago
7 0

Answer:

Explanation:

The following is written in Java and has the methods as requested in the question...

class Dog {

   private double age;

   public Dog(double v) {

       assert v >= 0:" Not valid";

       this.age = v;

   }

   public boolean isOlder(Dog dog1, Dog dog2) {

       if (dog1.age > dog2.age) {

           return true;

       } else {

           return false;

       }

   }

}

You might be interested in
To increase security on your company's internal network, the administrator has disabled as many ports as possible. Now, however,
tia_tia [17]

Answer: 443

Explanation:

Port 443 will need to be enabled for secure transactions to go through because it is the default port for HTTPS which is the transfer protocol for secure communication.

This way your credit card transactions will be encrypted to ensure protection from those who would seek to steal your data and your money.  

8 0
3 years ago
How did technology change the world
Crank

Answer:

Technology has changed the world for the better.

Explanation:

Without technology, many of the things we take for advantage, such as, credit cards, calling people from far distances, heck even being able to call to across the world from where you are right now. Technology has revolutionized many things we use commonly on a day-to-day basis.

3 0
2 years ago
Read 2 more answers
CHALLENGE ACTIVITY |
fredd [130]

Answer:

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);  

The maxSum is a double type variable which is assigned the maximum of the two variables numA numB PLUS the maximum of the two variables numY numZ using FindMax function. The FindMax() method is called twice in this statement one time to find the maximum of numA and numB and one time to find the maximum of numY numZ. When the FindMax() method is called by passing numA and numB as parameters to this method, then method finds if the value of numA is greater than that of numB or vice versa. When the FindMax() method is called by passing numY and numZ as parameters to this method, then method finds if the value of numY is greater than that of numZ or vice versa. The PLUS sign between the two method calls means that the resultant values returned by the FindMax() for both the calls are added and the result of addition is assigned to maxSum.

Explanation:

This is where the statement will fit in the program.

#include <iostream>

using namespace std;

double FindMax(double num1, double num2) {

  double maxVal = 0.0;    

  if (num1 > num2) { // if num1 is greater than num2,

     maxVal = num1;  // then num1 is the maxVal.    }

  else {          

     maxVal = num2;  // num2 is the maxVal.   }

  return maxVal; }  

int main() {

  double numA;

  double numB;

  double numY;

  double numZ;

  double maxSum = 0.0;  

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);  

  cout << "maxSum is: " << maxSum << endl;   }

Lets take an example to explain this. Lets assign values to the variables.

numA = 6.0

numB = 3.0

numY = 4.0

numZ = 9.0

maxSum =0.0

maxSum = FindMax(numA, numB) + FindMax(numY, numZ);  

FindMax(numA,numB) method call checks if numA>numB or numB>numA and returns the maximum of the two. Here numA>numB because 6.0 is greater than 3.0. So the method returns numA i.e. 6.0

FindMax(numY, numZ) method call checks if numY>numZ or numZ>numY and returns the maximum of the two. Here numZ>numY because 9.0 is greater than 4.0. So the method returns numZ i.e. 9.0

FindMax(numA, numB) + FindMax(numY, numZ) this adds the two values returned by the method FindMax for each call.

FindMax returned maxVal from numA and numB values which is numA i.e. 6.0.

FindMax returned maxVal from numY and numZ values which is numZ i.e. 9.0.

Adding these two values 9.0 + 6.0 = 15

So the complete statement  FindMax(numA, numB) + FindMax(numY, numZ) gives 15.0  as a result.

This result is assigned to maxSum. Hence

maxSum = 15

To see the output on the screen you can use the print statement as:

cout<<maxSum;

This will display 15

6 0
2 years ago
Early photographers take to work with what in order to produce photographs? (Btw this is photography, it just isn't a subject in
Kruka [31]
1, they used to use chemicals.
4 0
3 years ago
A campfire is a good source of heat and light on a cool night. The energy that is released when firewood is burned comes from th
Makovka662 [10]
Chemical reactions in the material used to make matches, and the cardboard... so hope this helps :)

NOTE: im not to good at this stuff so i rlllllly hope it helps























































3 0
3 years ago
Other questions:
  • What type of document would you use the landscape page orientation
    7·1 answer
  • SecOps focuses on integrating the need for the development team to provide iterative and rapid improvements to system functional
    11·1 answer
  • Is instant messaging a form of synchronous communication
    10·1 answer
  • When excel imports an access table, the data is placed in a worksheet _____?
    7·1 answer
  • In a natural-language processing (NLP) system, the__________activity involves using the computer to read large amounts of text a
    9·1 answer
  • How can you tell that a spreadsheet was saved as a 2007 Excel file?
    7·1 answer
  • Write a program that takes a point (x,y) from theuser and find where does the point lies. The pointcan
    8·1 answer
  • What is the code i need to do
    12·1 answer
  • Edhesive 3.4 practice 1
    9·1 answer
  • Which type of network allows backups and network security to be centrally located?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!