answer.
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
qaws [65]
2 years ago
10

Write a program that implements a class called Dog that contains instance data that represent the dog's name and age. • define t

he Dog constructor to accept and initialize instance data. • create a method to compute and return the age of the dog in "person-years" (note: dog age in person-years is seven times a dog's age). • Include a toString method that returns a one-line description of the dog • Write a driver class called Kennel, whose main method instantiated and updates several Dog objects
Computers and Technology
1 answer:
g100num [7]2 years ago
7 0

Answer:

<u>Dog.java:</u>

Dog{

   //Declare instance variables

   private String name;

   private int age;

   

   //Create the constructor with two parameters, and initialize the instance variables

   public Dog(String name, int age){

       this.name = name;

       this.age = age;

   }

   

   //get methods

   public String getName(){

       return name;

   }

   

   public int getAge(){

       return age;

   }

   

   //set methods

   public void setName(String name){

       this.name = name;

   }

   

   public void setAge(int age){

       this.age = age;

   }

   

   //calculateAgeInPersonYears() method to calculate the age in person years by multiplying the age by 7

   public int calculateAgeInPersonYears(){

       return 7 * getAge();

   }

   

   //toString method to return the description of the dog

   public String toString(){

       return "Name: " + getName() + ", Age: " + getAge() + ", Age in Person Years: " + calculateAgeInPersonYears();

   }

}

<u>Kennel.java:</u>

public class Kennel

{

public static void main(String[] args) {

          //Create two dog objects using the constructor

          Dog dog1 = new Dog("Dog1", 2);

          Dog dog2 = new Dog("Dog2", 5);

          //Print their information using the toString method

          System.out.println(dog1.toString());

          System.out.println(dog2.toString());

          //Update the first dog's name using setName method

          dog1.setName("Doggy");

          System.out.println(dog1.toString());

          //Update the second dog's age using setAge method

          dog2.setAge(1);

          System.out.println(dog2.toString());

}

}

Explanation:

*The code is in Java.

You may see the explanations as comments in the code

You might be interested in
Which two statements are true regarding online professional identity?
DerKrebs [107]

Answer:

Posts on FB can affect a person's professional identity.

Employers will expect to view your job history if you have a profile on Linkedin.

Explanation:

6 0
2 years ago
A credit card company receives numerous phone calls throughout the day from customers reporting fraud and billing disputes. Most
Veronika [31]

Answer:

3.59 minutes

Explanation:

We solve this question using z score formula

Using Excel

Z-SCORE= (DataPoint-AVERAGE(DataSet))/STDEV(DataSet)

IN EXCEL,

AVERAGE, an excel function that calculates the Average of data set

STDEV.S: calculates the standard deviation while treating the data as a ‘sample’ of a population.

STDEV.P: This function calculates the standard deviation while treating the data as the entire population.

Z score formula = x - μ/σ

x = ?? μ = 2.5 minutes σ = 0.5 minutes

We are asked : If 1.5% of the callers are put on hold for longer than x minutes, what is the value of x?

Hence, Longer than = Greater than =

100 - 1.5%

= 100 - 0.015

= 0.985 ( 98.5%)

Using Excel we calculate = z score for 98.5 percentile

= 2.1701

Z score = x - μ/σ

2.1701 = x - 2.5/0.5

2.1701 × 0.5 = x - 2.5

1.08505 = x - 2.5

x = 1.08505 + 2.5

x = 3.58505

Approximately to 2 decimal places = 3.59 minutes

Therefore, 1.5% of the callers are put on hold for longer than 3.59 minutes.

8 0
2 years ago
To gain experience of using and combing different sorting algorithms: election sort, insertion sort, merge sort, and quick sort.
ch4aika [34]

Answer:

Motivation? The search problem.

Sorting algorithms: insertion sort, shellsort, heapsort, mergesort, quicksort, bubblesort

At the very least, "general purpose" sorting algorithms require O(n log n) comparisons

Explanation:

3 0
2 years ago
Assume a program requires the execution of 50 x 106 FP instructions, 110 x 106 INT instructions, 80 x 106 L/S instructions, and
Molodets [167]

Explanation:

FP - 50 \times 10^6

CPI - 1

INT -110 \times 10^6,

CPI - 1

I/S - 80 \times 10^6 ,

CPI - 4

Branch - 16 \times 10^6

CPI - 2

Clock Speed - 2 \times 10^9

Time(old) =\frac{50 x 10^6 + 110 x 10^6 + 4 x ( 80 x 10^6) + 2 x (16 x 10^ 6)}{2 x 10^9}

Time(old) = 256 \times 10^ {-3}

Time(new) =  \frac{256 \times 10^{-3}}{2}

                = 128 \times 10^{-3}

                =\frac{CPI(new) x [50 x 10^6 + 110 x 10^6 + 4 x ( 80 x 10^6) + 2 x (16 x 10^ 6)]}{2 x 10^9}

                =  128 \times 10^{-3}

CPI(new) = \frac{-206}{50}

               = -4.12

3 0
2 years ago
In step 4 of the CSMA/CA protocol, a station that successfully transmits a frame begins the CSMA/CA protocol for a second frame
DerKrebs [107]

Answer:

There could be a collision if a hidden node problem occurs.

Explanation:

CSMA/CA(carrier sense multiple access/ collision avoidance) is a multiple access method in wireless networking, that allows multiple node to transmit. Collision avoidance of this method is based on preventing signal loss or downtime as a result of collision of transmitting multi signals.

If a node at step 4(transmit frame) sends the first frame, the node still needs to send a RTS(request to send) and to receive a Clear to send (CTS) from the WAP, the is to mitigate the issue of hidden node problem as all frame are treated as unit, so other listening nodes, not detected would seek to connect and transmit as well.

5 0
2 years ago
Other questions:
  • Represent decimal number 8620 in (a) BCD, (b) excess-3 code, (c)2421 code, and (d) as a binary number
    7·1 answer
  • Suppose you define a java class as follows: public class test { } in order to compile this program, the source code should be st
    14·1 answer
  • Explain the following instructions: ADD 3000, 1050, 1900.
    12·1 answer
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • True or False: A class that implements an interface may only implement a few of that interface's method declarations
    13·1 answer
  • Discuss the importance of following a well-integrated change control process on IT projects. What consequences can result from n
    14·1 answer
  • Program MATH_SCORES: Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final
    7·1 answer
  • To reduce costs and the environmental impact of commuting, your company decides to close a number of offices and to provide supp
    14·1 answer
  • For a data structure, such as a stack, who is responsible for throwing an exception if the stack is empty and a pop() is called:
    13·1 answer
  • What are the two atomic operations permissible on semaphores?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!