Discount Get CIS 247B ALL WEEKS Solution ONLY $84.70 $112.93
CIS 247B Week 1 - in Java [$8.99]
CIS 247B Week 2 - in Java – Object Construction and Data Abstra... [$15.99]
CIS 247B Week 3 - in Java - Overloaded Methods and Static Methods... [$15.99]
CIS 247B Week 4 - in Java - Composition and Class Interfaces [$15.99]
CIS 247B Week 5 - in Java - Composition, Inheritance, and Polymor... [$15.99]
CIS 247B Week 6 - in Java - Interfaces and Abstract Classes [$19.99]
CIS 247B Week 7 - in Java - Putting It All Together [$19.99]
Get Selected Weeks Solution with ONLY NOT Add Selected Tutorials To Cart
CIS247 CIS 247 CIS/247 - CIS247B - Week 7 - Lab 7 - iLab 7 - in Java - Putting It All Together - Guaranteed 100% score
    CIS247 CIS 247 CIS/247 - CIS247B - Week 7 - Lab 7 - iLab 7 - in Java - Putting It All Together - Guaranteed 100% score

CIS247 CIS 247 CIS/247 - CIS247B - Week 7 - Lab 7 - iLab 7 - in Java - Putting It All Together - Guaranteed 100% score

$19.99

iLab 7 of 7: Putting It All Together

Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus “Due Dates for Assignments & Exams” for due dates.)

i L A B O V E R V I E W
Scenario and Summary
This week, you will be implementing inheritance by creating a generic Racer superclass along with two subclasses called StreetTuner and HotRod. You will make the Racer class abstract and include the abstract method IsDead in the Racer class.
Deliverables
Due this week:

  • Capture the console output window and paste it into a Word document.
  • Zip the project folder.
  • Put the zip file and screenshots (Word document) in the Dropbox.

i L A B S T E P S
STEP 1:
Understand the UML Diagram

Engine:

-cylinders: int

-horsepower:int

+Engine()

+Engine(in cylinders: int , in horsePower :int)

+toString(): string

Racer:

-name: string

-speed: int

-eng: Engine

+Racer()

+Racer(in name: string, in speed:int, in engine: Engine)

+isDead():bool +toString():string

HotRod (point to Racer):

-blower:bool

+HotRod()

+HotRod(in name: string, in speed: int, in engine: Engine, in blower: bool)

+isDead():bool

+toString():string

StreetTuner (point to Racer):

-nitrous: bool

+StreetTuner()

+StreetTuner(in name: string, in speed:int, in engine: Engine, in nitrous:bool)

+isDead():bool

+toString(): string
STEP 2: Build the Inheritance Hierarchy

Create a project called “CIS247B_WK7_Lab_LASTNAME”
Build the class structure shown in the UML diagram. Remember to include getters and setters for each class attribute.
STEP 3: Implement Logic for HotRod Class

  1. Provide suitable logic for the toString method. As always, the toString method should reveal the state of an object.
  2. For the isDead method in HotRod, use the logic below to implement the inherited base class abstract method called isDead.

Hint: To generate a random number, use the following code, which returns a random number from 0 to 1:
Random rnd = new Random();
rnd.NextDouble();

Pseudocode for the isDead method of HotRod:

 Random rnd = new Random();

boolean dead if (speed > 50 && rnd.NextDouble() > 0.6)

if (engineHorsePower < 300 && blower=true)

dead = false

else

dead = true

end if else if (speed > 100 && rnd.NextDouble() > 0.4)

if (engineHorsePower >= 300 && blower = true)

dead = true

else

dead = false

end if

else

dead = false

end if
STEP 4: Implement Logic for StreetTuner Class

  1. Provide suitable logic for the toString method. As always, the toString method should reveal the state of an object.
  2. For the isDead() method in StreetTuner, use the logic below to implement the inherited base class abstract method called isDead.

Pseudocode for the isDead method of StreetTuner

Random rnd = new Random();

boolean dead if (speed > 50 && rnd.NextDouble() > 0.6)

if (engineHorsePower < 300 && nitrous=true)

dead = false

else

dead = true

end if

else if (speed > 100 && rnd.NextDouble() > 0.4)

if (engineHorsePower >= 300 && nitrous = true)

dead = true

else

dead = false

end if

else

dead = false

end if
STEP 5: Construct the Main Program

Hint: When completing the Main Class for your lab, feel free to reuse old methods from previous labs!

  1. Create an array of Racer objects that will hold three Racer objects.
  2. Write a method, called collectRacerInformation that accepts as an argument a Racer object, and then prompts the user to provide the following information for each racer.
    1. Racer name
    2. Racer Speed
    3. Number of cylinders in the racer’s engine
    4. Horsepower of the racer’s engine
  3. Add logic to collectRacerInformation to determine if the Racer object passed in is a HotRod or a StreetTuner. If it is a HotRod, prompt the user to indicate the existence of a blower. If the object is a StreetTuner, prompt the user to indicate the existence of nitrous. Set these values appropriately.
  4. Write a method called displayRacerInformation that accepts as an argument a Racer object, and then displays all the information for the specific racer type.
  5. Create any combination of Racer objects (make sure you create at least one StreetTuner and one HotRod) and invoke collectRacerInformation, passing in each of the Racer objects. Store each object in the array. For StreetTuner objects, be sure to set the nitrous flag (either true or false), and for the HotRod objects set the blower flag (either true or false).
  6. Iterate through the racer array and, for each Racer object, display all the object’s attribute information (call the displayRacerInformation method for each object). Don’t forget to indicate whether or not the Racer is dead!

STEP 6: Compile and Test

When done, compile and execute your code, and debug any errors until your code is error-free.
Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.
Your code may resemble the following:

************Racer Information*************

Name: HotRod Racer

Speed: 85

**Engine Information**

Cylinders: 8

Horse Power: 100

Blower: true

Is the Racer dead? No

**************Racer Information****************

Name: StreetTuner Racer #1

Speed: 95

**Engine Information**

Cylinders: 10

Horse Power: 135

Nitrous: false

Is the Racer dead? Yes

*****************Racer Information***************

name: StreetTuner Racer #2

Speed: 103

**Engine Information**

Cylinders 12

Horse Power: 150

Nitrous: true

Is the Racer dead? No
STEP 7: Submit Deliverables

Submit your lab to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, read these Step-by-Step Instructions or watch this Dropbox Tutorial.
See Syllabus “Due Dates for Assignments & Exams” for due date information.

Solution for CIS247 Week 7 Lab 7 in Java

It is 100% correct solution

How to using solution?

Using any Java IDE (ex Eclipse or Netbean), copy all source codes to src folder, then open and run main class (File Main.Java).

If you have more questions, please contact me via email support@extutorials.com, i will help you any time

Thank you

Attached Files

Move over [ preview ] file name to preview content in it!

  • CIS247B-Week7.zip [618.3KB]
    • Document.docx [488.9KB]
    • Eclipse Project
      • CIS247B_WK7_Lab_LASTNAME
        • .classpath
          • .project
            • bin
            • src
              • Engine.java [0.6KB] [ preview ]
              • HotRod.java [1KB] [ preview ]
              • Main.java [1.7KB] [ preview ]
              • Racer.java [0.8KB] [ preview ]
              • StreetTuner.java [1.1KB] [ preview ]
        • ScreenShot-CIS247B-Week7.jpg [108.8KB]
        • source code
          • Engine.java [0.6KB] [ preview ]
          • HotRod.java [1KB] [ preview ]
          • Main.java [1.7KB] [ preview ]
          • Racer.java [0.8KB] [ preview ]
          • StreetTuner.java [1.1KB] [ preview ]

      Write a review

      Your Name:


      Your Review: Note: HTML is not translated!

      Rating: Bad           Good

      Enter the code in the box below:



      PURCHASE SAVE
      2 Tutorials 10%
      3 Tutorials 13%
      4 Tutorials 16%
      5 Tutorials 19%
      6 Tutorials 22%
      7 Tutorials 25%
      8 Tutorials 28%
      9 Tutorials 31%
      10 Tutorials 34%
      add url more

      9MZQASHWN73B