Display a menu to the user on the screen

Assignment Help Computer Engineering
Reference no: EM132109289

In this project you will define some interfaces, abstract classes, and concrete classes, all placed in a specific package. You will also use the instanceofoperator. Note: if you do not use interfaces, abstract classes, and/or instanceof, you will not receive full credit.

Project description:

1. Define an interface called Nameable with the following methods:

String getName() void setName(String name)
2. Define an interface called Runner with the following method:

void run()
3. Define an interface called Flyer with the following method:

void fly()
4. Define an abstract class called Animal which must implement the Nameable interface. Add the representation of:

Animal's name,

Animal's number of legs,

Animal's age, and

Keep count of the instances of the Animal class by using a static variable.

If you believe you should define a variable as static, or final, or even both, do so and briefly mention the reason as a comment on that variable in javadoc format (see below).

Use suitable qualifiers for all fields in the class.

5. Define a class called Dog, where a Dog is-a subclass of Animal. Also, a Dog can run (i.e. this class should implement the Runner interface).

6. Define a class called Cat, where a Cat is-a subclass of Animal. Also, a Cat can run (i.e. this class should implement the Runner interface).

7. Define a class called FlyCat, where a FlyCat is-a (imaginary) subclass of Animal that can fly (i.e. this class should implement the Flyerinterface).

8. Define a class called Dragon, where a Dragon is-a (imaginary) subclass of Animal that can both run and fly (i.e. this class should implement both the Runner and Flyer interfaces).

9. Each of the Animal subclasses has one or two capabilities: it can fly, or run, or both. When one calls fly on an animal that can fly, fly should print [name of the animal] + " is flying". Similarly run should print [name of the animal] + " is running".

10. Be creative and find more Animal kinds (at least two more). One of these new animal types (can be imaginary) should be able to both fly and run, and should be a direct subclass of Animal.

11. Create three animals of each type (3 dogs, 3 cats, etc), with different given names and suitable attribute values. The names can be as simple as Joe1, Joe2, etc.

12. Store the Animal objects (above) in an array of type Animal.

13. Display a menu to the user on the screen (before implementing this part, read the notes below).

Press 1 to see how many animals are in the system.

Press 2 to see the name and kind of each animal.

Press 3 to see which animals can fly.

Press 4 to see which animals can run.

Press 5 to see which animals can run AND fly.

Press 6 to see a description of each animal.

Press q to terminate the program.

14. Important notes about the menu:

If the user enters anything other than {1, 2, 3, 4, 5, 6, q}, the program should print a proper error message, and ask the user to enter a number between {1, 2, 3, 4, 5, 6} or 'q' (to quit). In other words, your program should not continue (or even worse, crash) if the user enters a wrong choice.

In option 1, the result should be the total number of instances of Animal class created so far (use the static variable).

For option 2, use instanceof to get kind.

For option 3, use instanceof. The result should contain both name (Joe1, Joe2, etc) and type (Dog, Cat, etc) of the animal.

For option 4, use instanceof.The result should contain both name and type (Dog, Cat, etc) of the animal.

For option 5, use instanceof. The result should contain both name and type (Dog, Cat, etc) of the animal.

Option 6 above could display something like this:

I am a 3 years old Dog and my name is Joe2. I have 4 legs and I can run.
Things to note:

Your program must be in package zoo.

You must provide setters and getters for all instance variables in classes.

Follow good coding style (proper variable names, indentation, etc).

Your design should be reasonably efficient, and in accordance with object oriented design principles (encapsulation, information hiding, inheritance, etc.).

If you are defining a variable as public or protected, briefly mention the reason for that.

If you are defining a variable as static or final, briefly mention the reason for that, as well.

Write your important comments in a way that is usable by javadoc. You should use appropriate tags in your comments. Important comments include:

Explanation of what a specific variable is. Such a comment will be used by javadoc only if it is for a public or protected variable. So if you have provided a comment for a private variable and it does not show up in the HTML files, that is ok.

Explanation of what a function does, its parameters, its return types, the exceptions it may throw.

Reference no: EM132109289

Questions Cloud

Create a java application that grades a multiple choice quiz : Prompt the user to enter the number of questions for the quiz, then prompt the user to enter the answer key for each question. Use an array.
Create an inventory database for a manufacturing facility : This project asks to create an inventory database for a manufacturing facility in Access. You are free to create whatever type of facility you would like.
Prompts the user to enter two lists of integers : Write a program with class name StrictlyIdentical that prompts the user to enter two lists of integers of size 5 and displays .
Research center at federal reserve : The Research Center at Federal Reserve looks at one key variable for policy makers in setting interest rates to maintain stable inflation. What is that variable
Display a menu to the user on the screen : Define a class called Dog, where a Dog is-a subclass of Animal. Also, a Dog can run (i.e. this class should implement the Runner interface).
Unanticipated dollar appreciation : After an unanticipated dollar appreciation has occurred, what recommendation a company such as Cummins Engine to do with its strong domestic currency?
Billions of shoppers worldwide : An online shopping tax punishes Aussie consumers and denies shoppers the same choice available to billions of shoppers worldwide.
Construct and execute insert sql statements : Construct and execute INSERT SQL statements to add the sample data in the following tables to the Customer and Address tables.
Describe your findings in your eportfolio : Assignment - Paperback Zone - ITECH1100 Understanding the Digital Revolution - Andres and Benjamin want to improve the consistency of how they pay

Reviews

Write a Review

Computer Engineering Questions & Answers

  What are the range of values of the multiplier coefficients

Analyze the digital filter structure of figure where all multiplier coeffcients are real and determine the transfer function H(z) = Y(z)/X(z).

  What types of technology will be involve in the architecture

Identify what types of technology will be involved in the architecture and explain the purpose of each technology. Create a graphical representation of your recommended architecture.

  Which member function is invoked in a particular class

Which member function is invoked in a particular class when member function definition is overridden in several classes that are part of inheritance hierarchy?

  You are working with php a general-purpose server-side

you are working with php a general-purpose server-side scripting language that allows you to add a lot of function

  Evaluate rate at which melting occurs in terms of coductance

Let a piece of ice uniformly at 0°C be immersed in water at 27°C. Evaluate the rate at which melting occurs in terms of the conductance g.

  Convert the test images to a gray code representation

Convert the test images sena . img and omaha. img to a Gray code representation, and bit plane encode. Compare with the results for the non-Gray-coded representation.

  Examine the history of both successful and failed systems

Examine the history of both successful and failed systems of this type. What lessons can be extracted from them?

  Discuss the network handling code on a computer system

Ethics can be universally enforced and laws apply to everyone, Firewalls provide network protection based on a set of programs configured for each device

  Develop a schematic for a printer controller

Repeat Problem, assuming that the printer has a buffer that can hold 80 characters. Printing is activated only when the buffer is full.

  Describe the features of telecommunications networks

assume that you were recently hired by a manufacturing company as a systems administrator trainee. your first

  Extend the vector-adt package to include less than operator

Extend the Vector_ADT package to include a negation operator ("-") function that return a vector. Extend the Vector_ADT package to include a less than operator.

  Large programming team and perhaps work on multiple projects

You wonder how large programming teams be sure that they use the same naming conventions and that their programs work together even though they are created independently. You research the Internet and any resources at your disposal for information..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd