COP 3804 Intermediate Java - COP3804pgm4b_4 Professor: Michael Robinson e-mail : michael.robinson@cs.fiu.edu - At the beginning of your program add the following: /********************************************************************* Author : Your Name Course : Java section. Example Java-1, Java-2, Java-3, or Java-4 Professor : Michael Robinson Program # : Program Purpose/Description { A brief description of the program } Due Date : MM/DD/YYYY Certification: I hereby certify that this work is my own and none of it is the work of any other person. ..........{ your signature }.......... *********************************************************************/ -------------------------------------------------------------------------------- Worth 12 Points - 2 extra points above the total 100 points - Program must be named: yourLastNameFirstLetterOfYourFirstNamePgm4.java ex: robinsonMpgm4.java - Make sure the program is properly documented and aligned uniformally, according to our "JAVA Programming Rules", discussed in class and located at: http://users.cis.fiu.edu/~mrobi002/includes/JAVA_programmingRules I will take points off if you do not follow the programming instructions. Purpose of this program: ======================== Master the creation and implementation of: 1. Polymorphism begins at page 342 in our book 2. swap begins at page 301 in our book 3. sorting begins at page 303 in our book 4. recursion begins at page 319 in our book See our book in page 361 for graphical representations, where PolySuper is a super class sub1 extends PolySuper sub2 extends PolySuper sub3 extends PolySuper objectBuilder extends PolySuper, sub1, sub2, sub3 polimorphicArrays extends calling program multiAccess extends calling program ------------------------------------------------------------------------- Polymorphism ------------ ------------------------------------ | robinsonMSuperPgm4 super-class | | method1 | | method2 | | method3 | ------------------------------------ ^ ^ ^ ----------------------------------- | sub1 | sub2 | sub3 | | Super1 | Super2 | Supper3 | ----------------------------------- ^ ----------------------- | robinsonMTheBuilder | | sub-class | ----------------------- ^ ----------------------- | robinsonMOverloader | | sub-class | ----------------------- ^ -------------------------- | robinsonMTheDriverPgm4 | | driver-class | -------------------------- ------------------------------------------------------------------------- QUESTIONS: 1a) Create a Super Class named lastNameFirstNameInitialSuperPgm4 containing: Worth 0.50 points ( sub-total points 0.50 ). I) method1 that accepts one int and can not be inherited displaying the int value received. Worth 0.50 points ( sub-total points 1.00 ). II) method2 that accepts two strings and displays them, and also displays I am super method2. Worth 0.50 points ( sub-total points 1.50 ). III) method3 that accepts nothing and displays I am super method3 ------------------------------------ | robinsonMSuperPgm4 super-class | | method1 | | method2 | | method3 | ------------------------------------ ------------------------------------------------------------------------- 1b) Worth 1.50 points ( sub-total points 3.00 ). Create three sub classes named sub1, sub2, and sub3 which are sub classes of the Super Class in question 1a, and are also Super Classes themselves, which can be inherited, each worth 0.50 points. ----------------------------------- | sub1 | sub2 | sub3 | | Super1 | Super2 | Supper3 | ----------------------------------- ------------------------------------------------------------------------- 1c) Worth 0.50 points ( sub-total points 3.5 ). Create a sub class named lastNameFirstInitialTheBuilder, which is a sub class of sub2/Super2 class and displays all methods of the lastNameFirstNameInitialSuperPgm4 super class ONLY plus the words: I am TheBuilder ----------------------- | robinsonMTheBuilder | | sub-class | ----------------------- ------------------------------------------------------------------------- 1d) Worth 0.50 points ( sub-total points 4 ). Write a sub-class program called lastNameFirstInitialOverloader containing all inheritable methods from your super class in question 1 ( lastNameFirstNameInitialSuperPgm4 ), connecting to sub2 in question 1b), overloading method2 by displaying "Hello I am the Overloader" ----------------------- | robinsonMOverloader | | sub-class | ----------------------- ------------------------------------------------------------------------- 1e) Worth 2 points ( sub-total points 6 ). Create a driver class (with a main method) named lastNameFirstNameInitialTheDriverPgm4 (example robinsonMTheDriverPgm4) using all methods in all classes from questions 1a, 1b, 1c and 1d. -------------------------- | robinsonMTheDriverPgm4 | | driver-class | -------------------------- ------------------------------------------------------------------------- 2) Worth 2 points ( sub-total points 8 ). Swap in Chapter 12 begins, at page 301 in our book. Using the swap program we learned in class, display the following numbers 784, 5, 123, 56 places them in order from the lowest to the highest and display the results. ------------------------------------------------------------------------- 3) Worth 2 points ( sub-total points 10 ). Sorting in Chapter 12 begins, at page 303 in our book. Create a single dimension array with you first and last name. Using a bubble sort display the contents of the above array in alphabetical order. ------------------------------------------------------------------------- 4) Worth 2 points ( sub-total points 12 ) Recursion in Chapter 12, begins at page 319 in our book. Create a recursion program to find the factorial of 10. In each loading step display "Calling step X" In each returning step display their corresponding values such as: Dec Total 4! = 4*3! = 4*6 = 24 We have FREE tutoring from Monday thru Saturday, please visit: - Our online or/and face2face tutoring FREE services. - I have Office Hours twice a week. - If you have any questions please email me at michael.robinson@fiu.edu, using your FIU email Please remember that we are here to help you succeed in your classes