Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Javadoc problem.. Given the enclosed java source files, add Javadoc comments to all 3! 4 5 1 package com.majorityof1.www.exhibit; 2 3 public class Animal {

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribedimage text in transcribed

Javadoc problem.. Given the enclosed java source files, add Javadoc comments to all 3! 4 5 1 package com.majorityof1.www.exhibit; 2 3 public class Animal { 1* classes Like Animal consist of data * members (internal variables) and 6 * methods (or member functions). 7 * In short, they are composed of * attributes and processes that 10 * allow us interact with or * manage said attributes. */ /** 11 12 13 14 15 16 17 18 * Constructor function to create animal * objects. */ Animal({ } Animal(String 5){ species Es; } 21 22 23 24 25 26 27 28 29 Animal(String n, Strings, int spd, boolean d){ this(s); setName(n); setSpeedMPH (spd); setDomStat(d); 30 31 32 33 34 35 36 37 38 39 40 41 42 43 } /* accessor ('get'/'read') * methods to follow... */ public int getSpeed() { return speedMPH; } public String getName() { return name; } 45 46 47 48 public String getSpecies() { return species; } 49 50 51 52 53 54 55 public boolean isDomesticated() { return domesticated; } * 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80} /* mutator ('set'/'write') methods to follow.../ public void setSpeedMPH(int spd) { speedMPH = spd; } public void setName(String n) { name = n; } public void setSpecies (String s) { species = 5; } public void setDomStat(boolean d) { domesticated - d; } /* Data members.../ protected int speedMPH; protected String name; protected String species; protected boolean domesticated = true; 1 package com.majorityof1.www.exhibit; 2 3 public class Animaluser { 4 5 6 7 8 9 10 public static void main(String[] args) { 1* Create a new animal object (or * User-defined data type). */ Animal a = new Animal(); a.setSpecies ("Cat"); a.setName("Cool"); a.setDomStat(true); a.setSpeedMPH(12); 12 13 14 15 16 17 18 19 20 Animal a2 = new Animal ("Dog"); Animal a3 = new Animal("Hayabusa", "Falcon", 120, false); System.out.println("We created an animal!"); System.out.println("Animal 'a' has the " + "following details "); System.out.println("Species:\t" + a.getSpecies() + " Name: \t" + a.getName() + " Speed:\t" + a.getSpeed) + " Domestication Status:\t" + a.isDomesticated); 26 27 28 29 31 32 33 34 36 37 38 39 40 41 42 43 System.out.println("Animal 'a2' has the + "following details "); System.out.println("Species:\t" + a2.getSpecies() + " Name: \t" + a2.getName() + " Speed:\t" + a2.getSpeed) + " Domestication Status:\t" + a2.isDomesticated()); System.out.println("Animal 'a' has the " + "following details "); System.out.println("Species:\t" + a3.getSpecies() + " Name: \t" + a3.getName() + " Speed:\t" + a3.getSpeed() + " Domestication Status:\t" + a3. isDomesticated); 46 47 48 49 50 51 52 Cat C = new Cat ("Thomas", 15, true); System.out.println("Cat 'c' has the " + "following details "); System.out.println("Species:\t" + c.getSpecies() + " Name: \t" + c.getName() + " Speed:\t" + c.getSpeed) + " Domestication Status:\t" + c.isDomesticated); 53 54 55 } 56) 1 package com.majorityof1.www.exhibit; 2 3 public class Cat extends Animal{ Cat({ super(); // calls Animal() } 8 11 calls Animal (String n, String s, int spd, boolean d) Cat(String name, int spd, boolean d) { super(name, "Cat", spd, d); } public int getSpd) { return speedMPH; } 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 public String getName() { return super.getName(); } public boolean isDomesticated() { return domesticated; } 26 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions

Question

Have you laid out a timeframe for refreshing the data regularly?

Answered: 1 week ago

Question

KEY QUESTION Refer to columns 1 and 6 in the table for question

Answered: 1 week ago