Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

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

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 3 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 28 Aug 2017 My Price 14.00

public static void

Guys I have some problems with this code. It wouldn't compile.

 

public class Driver
{
public static void main(String[] args)
{
Pet p = new Pet("Terrance");
p.printInfo();
System.out.println();
Mammal m = new Mammal();
m.printInfo();
m.setName("Roxie");
m.printInfo();
System.out.println();
Fish f = new Fish("red");
f.printInfo();
f.setName("Shark");
f.printInfo();
System.out.println();
Dog d = new Dog("Watson", "Basset");
d.printInfo();
}
}

 

----------------------------------------

 

public class Pet
{
protected String name;
public Pet(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setName(String inName)
{
name = inName;
}
public void printInfo()
{
System.out.println("The pet's name is " + name);
}
}

 

---------------------------------

 

public class Fish extends Pet
{
protected String color;
public Fish(String name, String color)
{
super(name);
this.color = color;
}
public void printInfo()
{
super.printInfo();
System.out.println("The fish is " + color + "and its name is " + getName());
}
}

 

----------------------------------

 

public class Mammal extends Pet
{

 

public Mammal(String name)
{
super(name);
}
public void setName(String inName)
{
name = inName;
}
public void printInfo()
{
//System.out.println("The pet's name is " + name);
}
}

 

--------------------------------

 

public class Dog extends Mammal
{
public Dog(String name)
{
super(name);
}
public void printInfo()
{
System.out.println("The dog's name is " + name + "and " + name);
}
}

 

-----------------------------

 

I need help please!

 

----------------------------

 

This is the output that should be printed:

The pet's name is Terrance The pet's name is fluffy The pet's name is Roxie The fish is red and its name is swimmy The fish is red and its name is Shark The dog's name is Watson and it's a Basset

Answers

(5)
Status NEW Posted 28 Aug 2017 10:08 PM My Price 14.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)