Question: Basic java programing Lab 06 - Inheritance and Polymorphism c. gstCartain retums a single String value containing the full name of the ship's captain sstCaptamo-accepts

Basic java programingBasic java programing Lab 06 - Inheritance and Polymorphism c. gstCartain retums

a single String value containing the full name of the ship's captain

Lab 06 - Inheritance and Polymorphism c. gstCartain retums a single String value containing the full name of the ship's captain sstCaptamo-accepts a smele Sting value that sets the value of the ship captain's full ame d. The organizing committee for the HCC Celebrates Columbia's 50n Binhday, Inc, has planneda special event commemorating notable people originally from Columbia, MD-The committee bas invited the family of late Columbia native and Oakland Mills High School graduate, Dr. Randy Pausch, as special guests at the event The event will honor the Carnegie Mellon University professor's contributions to computer science, human-computer interaction, and computer graphics 2. In file (Consthution fanva) specialize the Constitution class by adding another field that contains the percentage charge remaining on the ship's phaser banks. Specifically, add the following instance variable using the appropriate declaration and initialize its value in an appropriate manner with the default value provided in (a) below. Also add the appropriate accessor functions for the percentCharee instance variable part b Also include additional code that reduces the charge on the ship's phasers by 30% after each time the phases are fired as in (c) below. When the phaser banks are at drained to 0% or lower, display a message stating Dr. Pausch became nationally famous for his book, The Last Lecture", delivered at CMLU after learning that he had terminal p whose complete title was The Last Lecture: Really Achieving Your Childhood Dreams". The lecture is available on YouTube - The Last Lecture anc reatic cancer. His best-selling book was based on that lecture ParBanks Exhausted! ** a. percentCharge-initial phaser charge is 100% (ie, fully charged) A life-long Str Trek fan, Pausch was invited by film director J. J. Abrams to appear in a cameo role in the 2009 reboot of Star Trek. In addition to appearing in the film, he also has a line of dialogue at the beginning of the film. Dr. Pauach'sblog entry (for 12/1/2007) gushes at the prospect of his appearing in the Star Trek movic: b. gctEcccutCharz0 returns a double reflecting the current charge in the phasers c. firWapon0 modify implementation to simulate the phaserdrain. 3. In file (Gaiaxy Java) specialize the Galaxy class by adding another field to contain the number of photon torpedoes initially carried by this more advanced type of vessel. Specifically, add the following instance variable using the appropriate declaration and initialize in an appropriate manner with the default value provided in part (a) below. Add an instance variable to hold the name of the ship's sponsor as in part (b) belo. Also add an appropriate accessor method for the percentCharge instance variable as in part (c) below Also include code that reduces the number of remaining photon torpedoes by 10 after cach torpedo salvo is fired as in part (d) below. When all torpedoes have been fired, display a message stating uedu You have been asked to write a program that will be demonstrated at the commemoration It will pay homage to Dr. Pausch's Star Trek affinity. Specifically, you will build a simulation of his two favorite types of Federation vessels: the Constitution and Galaxy class starships. File StarShtp.java contains a declaration for a StarShip class. Save this file to your directory and study it-notice what instance variables and methods are provided. Files Galary java and Constitutionjava contain declarations for classes that extend the StarShip class. Save and study these files as well All Photon Torpedoes Expended! a. numTorpedoes initial weapons load is 32 b. SROREQ a String variable to hold the name of the ship's sponsor. c. geNuTornesoesD-retums a single integer value corresponding to the curent art the number of torpedoes remaining on the ship, i.e., the number of torpedoes remaining in the ship's torpedo inventory 1. In file (StarShip sava) enhance the StarShip class design by adding more fields. Specifically d. firWaponO modify implementation to include photon torpedo depletion. add the following instance variables to the StarShip class using the appropriate declaration and access specifier. Modify the constructor to initialize the new fields to the default values listed in (a) and (b) below: 4. Draw a UML class diagram depicting the inheritance hierarchy described above and implemented in your Java source code. a. homeport- "Earth McKinley Station" b. captain "Randy Paussh and StarSh Add and implement the following accessor methods for the StarShip class in (a) through (d) below Note After making the design enhancements in Part I above, you shouldn t need to make any major changes to the class files except to correct the errors discovered in this part and add the polymorphic methods described below a. getHomepeto returns a single String value corresponding to the ship's homeport. bKtHomsporo-accepts a single String value that sets the value of the ship's homeport. Lab 06 - Inheritance and Polymorphism c. gstCartain retums a single String value containing the full name of the ship's captain sstCaptamo-accepts a smele Sting value that sets the value of the ship captain's full ame d. The organizing committee for the HCC Celebrates Columbia's 50n Binhday, Inc, has planneda special event commemorating notable people originally from Columbia, MD-The committee bas invited the family of late Columbia native and Oakland Mills High School graduate, Dr. Randy Pausch, as special guests at the event The event will honor the Carnegie Mellon University professor's contributions to computer science, human-computer interaction, and computer graphics 2. In file (Consthution fanva) specialize the Constitution class by adding another field that contains the percentage charge remaining on the ship's phaser banks. Specifically, add the following instance variable using the appropriate declaration and initialize its value in an appropriate manner with the default value provided in (a) below. Also add the appropriate accessor functions for the percentCharee instance variable part b Also include additional code that reduces the charge on the ship's phasers by 30% after each time the phases are fired as in (c) below. When the phaser banks are at drained to 0% or lower, display a message stating Dr. Pausch became nationally famous for his book, The Last Lecture", delivered at CMLU after learning that he had terminal p whose complete title was The Last Lecture: Really Achieving Your Childhood Dreams". The lecture is available on YouTube - The Last Lecture anc reatic cancer. His best-selling book was based on that lecture ParBanks Exhausted! ** a. percentCharge-initial phaser charge is 100% (ie, fully charged) A life-long Str Trek fan, Pausch was invited by film director J. J. Abrams to appear in a cameo role in the 2009 reboot of Star Trek. In addition to appearing in the film, he also has a line of dialogue at the beginning of the film. Dr. Pauach'sblog entry (for 12/1/2007) gushes at the prospect of his appearing in the Star Trek movic: b. gctEcccutCharz0 returns a double reflecting the current charge in the phasers c. firWapon0 modify implementation to simulate the phaserdrain. 3. In file (Gaiaxy Java) specialize the Galaxy class by adding another field to contain the number of photon torpedoes initially carried by this more advanced type of vessel. Specifically, add the following instance variable using the appropriate declaration and initialize in an appropriate manner with the default value provided in part (a) below. Add an instance variable to hold the name of the ship's sponsor as in part (b) belo. Also add an appropriate accessor method for the percentCharge instance variable as in part (c) below Also include code that reduces the number of remaining photon torpedoes by 10 after cach torpedo salvo is fired as in part (d) below. When all torpedoes have been fired, display a message stating uedu You have been asked to write a program that will be demonstrated at the commemoration It will pay homage to Dr. Pausch's Star Trek affinity. Specifically, you will build a simulation of his two favorite types of Federation vessels: the Constitution and Galaxy class starships. File StarShtp.java contains a declaration for a StarShip class. Save this file to your directory and study it-notice what instance variables and methods are provided. Files Galary java and Constitutionjava contain declarations for classes that extend the StarShip class. Save and study these files as well All Photon Torpedoes Expended! a. numTorpedoes initial weapons load is 32 b. SROREQ a String variable to hold the name of the ship's sponsor. c. geNuTornesoesD-retums a single integer value corresponding to the curent art the number of torpedoes remaining on the ship, i.e., the number of torpedoes remaining in the ship's torpedo inventory 1. In file (StarShip sava) enhance the StarShip class design by adding more fields. Specifically d. firWaponO modify implementation to include photon torpedo depletion. add the following instance variables to the StarShip class using the appropriate declaration and access specifier. Modify the constructor to initialize the new fields to the default values listed in (a) and (b) below: 4. Draw a UML class diagram depicting the inheritance hierarchy described above and implemented in your Java source code. a. homeport- "Earth McKinley Station" b. captain "Randy Paussh and StarSh Add and implement the following accessor methods for the StarShip class in (a) through (d) below Note After making the design enhancements in Part I above, you shouldn t need to make any major changes to the class files except to correct the errors discovered in this part and add the polymorphic methods described below a. getHomepeto returns a single String value corresponding to the ship's homeport. bKtHomsporo-accepts a single String value that sets the value of the ship's homeport

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!