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
noname [10]
3 years ago
12

Define a method printAll() for class PetData that prints output as follows. Hint: Make use of the base class' printAll() method.

Computers and Technology
1 answer:
sveticcg [70]3 years ago
8 0

Answer:

// ===== Code from file AnimalData.java =====

public class AnimalData {

private int ageYears;

private String fullName;

public void setName(String givenName) {

fullName = givenName;

return;

}

public void setAge(int numYears) {

ageYears = numYears;

return;

}

// Other parts omitted

public void printAll() {

System.out.print("Name: " + fullName);

System.out.print(", Age: " + ageYears);

return;

}

}

// ===== end =====

// ===== Code from file PetData.java =====

public class PetData extends AnimalData {

private int idNum;

public void setID(int petID) {

idNum = petID;

return

}

// FIXME: Add printAll() member function

@override

Void printAll()

{

AnimalData a1=new AnimalData();

a1.printall();      

System.out.print(“id/;” +idNum);

}

}

// ===== end =====

// ===== Code from file BasicDerivedOverride.java =====

public class BasicDerivedOverride {

public static void main (String [] args) {

PetData userPet = new PetData();

userPet.setName("Fluffy");

userPet.setAge (5);

userPet.setID (4444);

userPet.printAll();

System.out.println("");

return;

}

}

// ===== end =====

Explanation:

In the program the main thing is overriding, and this condition mentioned in the program is perfect to explain what the overriding actually means in Java. All object oriented programming language supports overriding. And remember we can also create another class main and call the overriding printAll() method from the child class as its class is being inherited by the PetData class.

You might be interested in
Can u please help me solve this
azamat

Alice has twice as many pencils as Cara. Leon has three more pencils than Alice. The three children have a total of 58 pencils.

<h3>What are the no. of pencils?</h3>

The no. of pencils are there totally as the 11.

Read more about the basic maths:

brainly.com/question/19493296

#SPJ1

4 0
2 years ago
A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output i
Amanda [17]

Answer:

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

   //Prompt and receive user input

       System.out.println("Enter number of Steps");

       int numSteps = in.nextInt();

       double numMiles = numSteps/2000;

       //Print the formated number of miles

       System.out.printf("The equivalent miles is %.2f ",numMiles);

   }

}

Explanation:

  • This is solved using Java programming language
  • Scanner class is imported and used to receive user input (number of steps walked)
  • To convert number of steps to number of miles, we divide by 2000, Since the question says the pedometer treats walking 2,000 steps as walking 1 mile.
  • Output the number of miles to 2 decimal places using java's printf() method
6 0
3 years ago
Read 2 more answers
Acceleration is the rate at which an object changes its velocity. It is typically represented by symbol a and measured in m/s2 (
Natalija [7]

Answer:

<u>Pseudocode:</u>

INPUT velocity

INPUT time

SET velocity = 0.44704 * velocity

SET acceleration = velocity / time

SET acceleration = round(acceleration, 1)

PRINT acceleration

<u>Code:</u>

velocity = float(input("Enter a velocity in miles per hour: "))

time = float(input("Enter a time in seconds: "))

velocity = 0.44704 * velocity

acceleration = velocity / time

acceleration = round(acceleration, 1)

print("The acceleration is {:.2f}".format(acceleration))

Explanation:

*The code is in Python.

Ask the user to enter the velocity and time

Convert the miles per hour to meters per second

Calculate the acceleration using the formula

Round the acceleration to one decimal using round() method

Print the acceleration with two decimal digits

7 0
3 years ago
Ep-34 where should you aim a fire extinguisher's stream when extinguishing a fire?
patriot [66]
When extinguishing a fire, the extinguisher's stream should be aimed at the base of the flame using a sweeping motion. This will allow one to kill the fire from the source. This will quickly put out the fire faster applying the extinguisher from the upside.
8 0
4 years ago
Discuss the advantages of Database approach to systemdevelopment
Sergeu [11.5K]

Answer:

Explained

Explanation:

Improved Data Sharing and Data Security

Proper database management systems help increase organizational accessibility to data, which in turn helps the end users share the data quickly and effectively across the organization.  A management system helps get quick solutions to database queries, thus making data access faster and more accurate.

Effective Data Integration

Implementing a data management system enhances an integrated picture of an organization’s operations. It becomes easy to see how processes in one segment of the organization affect other segments.

Increased productivity of end user

Deploying a database management system, will always result in the increased productivity of users.It empowers the end user to make well informed and quick decisions that can contribute in success and failure of any organization.

4 0
3 years ago
Other questions:
  • One disadvantage of using the styles feature of a word processor is that you cannot modify existing styles. true or false
    14·1 answer
  • Calculate the cash used to retire debt for each of the six months. Since the company can't pay down more debt than there is cash
    12·1 answer
  • Different video files and ______ can cause compatibility issues to arise between computer systems.
    8·1 answer
  • Write a MATLAB script that prompts the user to input the following array by providing an example in the prompt: [2 4;6 3;5 9]. C
    15·1 answer
  • select all examples of proper keyboarding technique. rest your fingers gently on the home row or home keys. slouch in your chair
    9·2 answers
  • What helps in determining the reliability of a person to repay debt?
    13·2 answers
  • Calculate the data rate capacity for a 2400 baud signal where there are M=8 levels per symbol. a. 2400 bps b. 4800 bps c. 7200 b
    12·1 answer
  • Why do the Brainly ads not end even after the timer reaches 0? Sometimes the Done Button does not appear.
    5·2 answers
  • Help teacher said with complete explanation ​
    5·1 answer
  • How to get free PS5?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!