SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 05 Jan 2018 My Price 10.00

Attributes for the Dog class are name (String)

C&O: Dog

a) Write a class to represent a Dog. This should include the following: 
    I). Attributes for the Dog class are name (String), breed (String), age (int), a unique licenceNo (int), and an attribute to indicate if the dog is dangerous called isDangerous (boolean). 
    ii). A default constructor which should set appropriate default values for each attribute except the licenceNo which is unique to each Dog object. 
    iii). A second constructor which accepts and sets values for each of the attributes. 
    iv). Getter and setter methods for name, breed, age, isDangerous. 
    v). A getter method for the licenceNo of each Dog object. 
    vi). A method called bark() that takes no parameters, returns nothing and prints the dog’s name by says Woof! Woof! Woof! when called. See sample output below.
    vii). A method called toString() that prints all details about a Dog object (see sample output below for format)
                NAME: <dog name> 
                BREED: <dog breed> 
                AGE: <dog age> 
                IS DANGEROUS? <is dog dangerous> 
                LICENCE NO: <licence number>

b) Write a main method in a new class called TestDog and in this method: 
     i). Declare an array of 3 Dog objects. Use the second constructor for the first 2 Dogs and the default constructor for the last Dog. 
                 Number     name      breed       age    isDangerous 
                     1             “Lady”   “Poodle”      2           False 
                     2           “Rocky”  “Pit Bull”      4           True 
    
ii). Call the setName(<…>), setBreed(<…>), setAge(<…>), setIsDangerous(<…>) method to change the information on the 3rd Dog. 
                 Num   name    breed       age    isDangerous 
                     3    “Spot”  “Dalmatian”   3     False

 

 iii). Call the getName(), getBreed(), getAge(), getIsDangerous() and getLicenceNo() methods to print the information of the 3rd Dog to the screen (it should be displayed exactly as the sample output below). 
    iv). Call the bark() method for all of the Dogs. 
    v). Use the ternary operator to print a message for each dog that states if it is dangerous.
    vi). Call the toString() method to print the details for the first 2 Dogs.

 

Attachments:

Answers

(5)
Status NEW Posted 05 Jan 2018 09:01 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)