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
According to the author, there are five hedging strategies organizations can pursue. One of them is: Select one: a. commit with
Kitty [74]

Answer:

The correct answer is letter "A": commit with fallback.

Explanation:

American Professor Alfred A. Marcus (born 1950) in his book "<em>The Future of Technology Management and the Business</em>" (2015) describes that hedging may be a strategy to shield businesses from the rapidly evolving world they face as a result of the continuous implementation of technology in the market. According to Marcus, there are 5 hedge approaches that firms should implement:

  1. Gamble on the most probable:<em> work on the product with the highest success rate. </em>
  2. Take the robust route: <em>invest in as many products as possible. </em>
  3. Delay until further clarity emerges:<em> waiting for a proper moment to react in front of market changes. </em>
  4. <u>Commit with a fallback</u>:<em> adapt according to the market. </em>
  5. Try to shape the future:<em> innovate.</em>
7 0
4 years ago
Write a statement that increments numUsers if updateDirection is 1, otherwise decrements numUsers. Ex: if numUsers is 8 and upda
Lady_Fox [76]

Answer:

Following are the statement is given below

if(updateDirection ==1) // check condition

{

++numUsers; // increments the value

}

else

{

--numUsers; // decrement the value

}

Explanation:

Following are the description of statement

  • Check the condition in the if block .If the "updateDirection" variable is 1 then then control moves to the if block otherwise control moves to the else block statement.
  • In the if  block the statement is "++numUsers" it means it increment the value by 1 .
  • In the else block the statement is "--numUsers" it means it decrement  the value by 1 .

4 0
3 years ago
What does SIP stand for?
agasfer [191]
Session Initiation Protocol, brainliest ?
4 0
3 years ago
Read 2 more answers
Mrs. Jackson wrote a newsletter to the customers of her housecleaning business that included some organizational tips they could
nika2105 [10]
The correct answer is a. effective communication

- - -
Ineffective and barriers to communication are problems that make communication unclear. Workplace communication is at work or at a job. This is not a job newsletter for workers, but for people at home.
5 0
4 years ago
Read 2 more answers
Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate avera
zalisa [80]

Answer:

Explanation:

#include<iostream>

#include<ctime>

#include<bits/stdc++.h>

using namespace std;

double calculate(double arr[], int l)

{

double avg=0.0;

int x;

for(x=0;x<l;x++)

{

avg+=arr[x];

}

avg/=l;

return avg;

}

int biggest(int arr[], int n)

{

int x,idx,big=-1;

for(x=0;x<n;x++)

{

if(arr[x]>big)

{

big=arr[x];

idx=x;

}

}

return idx;

}

int main()

{

vector<pair<int,double> >result;

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

int choice;

cin>>choice;

while(choice!=2)

{

int n,m;

cout<<"Enter N"<<endl;

cin>>n;

cout<<"Enter M"<<endl;

cin>>m;

int c=m;

double running_time[c];

while(c>0)

{

int arr[n];

int x;

for(x=0;x<n;x++)

{

arr[x] = rand();

}

clock_t start = clock();

int pos = biggest(arr,n);

clock_t t_end = clock();

c--;

running_time[c] = 1000.0*(t_end-start)/CLOCKS_PER_SEC;

}

double avg_running_time = calculate(running_time,m);

result.push_back(make_pair(n,avg_running_time));

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

cin>>choice;

}

for(int x=0;x<result.size();x++)

{

cout<<result[x].first<<" "<<result[x].second<<endl;

}

}

8 0
3 years ago
Other questions:
  • Being tired has very similar effects on the body as what
    7·1 answer
  • A stop sign is an example of?
    11·2 answers
  • 1⁰=?<br> Is equal to...........
    12·2 answers
  • How do you change a account on an iPod generation 5
    10·1 answer
  • Tricking someone to reveal personal information, passwords, and other information that can compromise a security system is known
    13·1 answer
  • Which practice is the safest way to sit at a desk while typing on the computer?
    12·1 answer
  • What are ip addresses? why are these important for forensic scientists?
    5·1 answer
  • How many of the colonists of Jamestown died before they made it to shore, due to the difficult voyage?
    15·1 answer
  • Design 3 classes: Computer - Superclass
    11·1 answer
  • In the space provided, analyze the pros and cons of becoming a member of an artistic guild. Your answer should be at least 150 w
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!