- Home >
- Programming >
- Java Programming

Studypool values your privacy. Only questions posted as Public are visible on our website.
Java Programming

Anonymous
label
Programming
timer
Asked: Nov 20th, 2016
Question description
Please use JGrasp.
Thanks
COP 2800, Java Programming, Fall B 2016
Due date: November 27th, 2016 midnight (11:59pm).
Assignment 5(10 points):
From Textbook page 424 use Listing 11.6 DynamicBindingDemo.java
Add a class that extends Object and a class that extends the new class you just created.
Add the code to create objects from the new classes you created which will print what each class is.
These new classes can be animal, vegetable or mineral, in other words just two classes that it makes
sense for the second class created to extend from the first class extend.
Hopefully you will find this an easy assignment for Thanksgiving week, and please contact me if you do
not understand my instructions.
Happy Thanksgiving.
At the beginning of the program add the following comments.
//Filename
//Written by
//Written on
//Assignment number
//Description of program
Purpose:
Create a java program from detailed directions.
Ability to:
Follow established programming conventions for writing java programs
Able to extend an Object and a class
Able to create objects from the classes created.
Upload your .java file in the Assignment 5 folder under “Assignments”.
Listing 11.6
DynamicBindingDemo.java
1 public class DynamicBindingDemo {
2 public static void main(String[] args) {
3 m( new GraduateStudent());
4 m( new Student());
5 m( new Person());
6 m( new Object());
7}
8
9 public static void m(Object x) {
10 System.out.println(x.toString());
11 }
12 }
13
14 class GraduateStudent extends Student {
15 }
16
17 class Student extends Person {
18 @Override
19 public String toString() {
20 return "Student" ;
21 }
22 }
23
24 class Person extends Object {
25 @Override
26 public String toString() {
27 return "Person" ;
28 }
29 }
Student
Student
Person
java.lang.Object@130c19b
Method m (line 9) takes a parameter of the Object type. You can invoke m with any object
(e.g., new GraduateStudent() , new Student() , new Person() , and new Object() )
in lines 3-6).
When the method m(Object x) is executed, the argument x 's toString method is
invoked. x may be an instance of GraduateStudent , Student , Person , or Object . The
classes GraduateStudent , Student , Person , and Object have their own implementations
of the toString method. Which implementation is used will be determined by x 's actual type
at runtime. Invoking m(new GraduateStudent()) (line 3) causes the toString method
defined in the Student class to be invoked.
Invoking m(new Student()) (line 4) causes the toString method defined in the Student class to be invoked; invoking m(new Person()) (line 5) causes the toString method
defined in the Person class to be invoked; and invoking m(new Object()) (line 6) causes
the toString method defined in the Object class to be invoked.
Matching a method signature and binding a method implementation are two separate
issues. The declared type of the reference variable decides which method to match at compile time. The compiler finds a matching method according to the parameter type, number of
parameters, and order of the parameters at compile time. A method may be implemented in

Similar Questions
How do i use wifi through broadband connection?
I have Reliance broadband wireless connection and i have a phone newly brought which supports wifi internet. So what shoud...
My netbook asks me to load default every time it starts?
Every time I switch on I get a message on a black screen asking me to press F2 to load default values and continue. This i...
How can I get started with web development?
Howdy.
I'm looking to get started with some web development stuff, but I really don't have any clue where to start. I see ...
Whats the easiest way to learn php?
I want to learn php, whats the best and fastest way to?...
How does likeplum work?
I was wondering how this site works, and what are these things called pledges...
Does JavaScript only work in .html file?
How can I implement JavaScript in .php file?...
Can someone tell me how to use Geocoding
I know there are some pages in Google API tell you how to use Geocoding
But can someone tells me what codes should I put i...
What do I need to start a website?
I just bought a website from godaddy.com, I don't know what to do next. I guess I technically bought only the domain name...
What are some good books and resources for learning JAVA
Hey, I want to learn some JAVA script and was wondering where I should get started, what books and resources....
Hot Questions
HMGT 300 Week 6 Quiz
Question
1 (4 points)
According to the National Institute
for Health Care Management: Understanding U.S...
The table lists the average annual cost of tuition and fees, algebra homework help
The table lists the average annual cost of tuition and fees
at private 4-year colleges for sel...
Need help with some Discussions about cultural issues that may impact on you as an ICT professional
Question 1Describe and discuss what cultural issues may impact on you as an ICT professional if your organisation mer...
MLA Works Cited - Quiz 10 question
Question 1 (1 point) The student is quoting from "Surveillance: Taking It Downtown" by Br...
questions end of term British and world literature
1. In his stories, Arthur Conan Doyle portrays Sherlock Holmes as __________.(Points : 5) an intelligent a...
Childhood Anxiety/ Ashford Univ EDU644
Hourigan, Settipani, Southam-Gerow, & Kendall (2012) explain, “Childhood anxiety disorders are among the most common...
Appropriate Quotation (MLA Style) - Quiz 10 quetion
Question 1 (1 point) [Original:]
Most editors test their covers in focus groups in an endless search for
the magi...
Identifying an Acceptable Paraphrase (MLA Style) - Quiz 10 question
Question 1 (1 point) [Ed: error here relates to close wording]The
original vision of charter schools in 1988, when ...
Payroll project.
I need help with this payroll project from Chapter 7. This is the book: Payroll Accounting, by Beig, Toland, edition 2017....
Related Tags
Study Guides
The Goldfinch
by Donna Tartt
Siddhartha
by Hermann Hesse
Freakonomics
by Stephen J. Dubner and Steven D. Levitt
Murder on the Orient Express
by Agatha Christie
Principles - Life and Work
by Ray Dalio
Cant Hurt Me - Master Your Mind and Defy the Odds
by David Goggins
Epic of Gilgamesh
by Unknown
How to Win at the Sport of Business
by Mark Cuban
A Brief History of Humankind Sapiens
by Yuval Noah Harari