Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class name starship. The starship class will be extended by a cruiser class and destroyer class. Create an ordinance class. This class will

Create a class name starship.

The starship class will be extended by a cruiser class and destroyer class. Create an ordinance class. This class will be extended by torpedo, ion bomb, and laser.

The starship class will have

Private field of ship type

Private field of shield level (the maximum health of the shield will be 100)

Private field health and of max health Private field of string type for condition (destroyed hulk, pristine, damaged) Properties to set and get (properties, not get set functions) the fields above

Private field named ordinance of type int (no properties for this)

Private field called firingDamage of type in (no properties for this)

Constructor that will o take in a string of the ship name, max ship health o will set the firing damage value

Method of fire

o Parameters of: starship object (the target)

o if the ship has the ordinance type left (count > 0) it will

reduce the ordinance count

call the targets takehit function

will use its firingDamage value to send to the takehit function

o a destroyed hulk cannot fire

o returns true if it fired (eg. Had the ordinance)

Method of takehit o Will take in an integer of the damage done

o This will reduce the shield health by the damage parameter

o If the shield gets to zero the remaining damage will be applied the ships health

o The damage will change the status of the ship

destroyed hulk if health = 0

damaged if health <> max health pristine if health = max health

o will print out that it was attacked and display its health, max health and ship condition

o If destroyed, print out the name of the ship and that it was destroyed

Method load o Will add 2 to the ordinance value The cruiser will have

A higher max health than any other ships The destroyer

Has lower max health other ships

The firing damage is twice as high as the cruiser Have ALL classes outside the main program. (DO NOT embed classes) In the main, create a bunch of different types of ships.

Have the ships fire at each other.

I need answer in C# visual studio with windows application form.

Please and thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions