Hello this is for my Java class project, thank you in advance Create the four data classes as diagram shown on the picture attached. Dont add any attributes or methods that don't appear in the UML diagrams. Create another, executable class named ShipTest as shown below to test these classes. ShipTest: make two objects with declared type Ship but actual type CruiseShip. make one object of declared type Ship but actual type CargoShip. make one object of declared type CargoShip and actual type CargoShip. make a ship of declared type WarShip and actual type WarShip. using the array initializer syntax, code all of these ships into an array of type Ship named fleet. code a for loop that processes the fleet array to show display all ships and their data. use a method of class Arrays to create an ArrayList of type Ship from the fleet array. pass this ArrayList to a method named shipShow that also displays all ships and returns an integer. report the value of the integer returned by shipShow. shipShow method: from the ArrayList, remove the CargoShip that was declared as type Ship. add another WarShip instance to the ArrayList. use a foreach loop to process the ArrayList and print the data for each ship. count the number of ships that are not afloat. Return this count to main for printing. SAMPLE OUTPUT AN ARRAY OF SHIPS IN MAIN Ship name: Magic, year launched: 1998, is afloat: true 2700 passenger capacity, operating in the Caribbean Ship name: Titanic, year launched: 1912, is afloat: false 1300 passenger capacity, operating in the Atlantic Ocean Ship name: El Faro, year launched: 1974, is afloat: false Capacity of containers is 391 Ship name: Seawise Giant, year launched: 1979, is afloat: false Capacity of crude oil is 564763 Ship name: USS Nimitz, year launched: 1972, is afloat: true Type: super carrier, operated by United States Navy ARRAYLIST OF SHIPS FROM A METHOD Ship name: Magic, year launched: 1998, is afloat: true 2700 passenger capacity, operating in the Caribbean Ship name: Titanic, year launched: 1912, is afloat: false 1300 passenger capacity, operating in the Atlantic Ocean Ship name: Seawise Giant, year launched: 1979, is afloat: false Capacity of crude oil is 564763 Ship name: USS Nimitz, year launched: 1972, is afloat: true Type: super carrier, operated by United States Navy Ship name: USS John Warner, year launched: 2015, is afloat: true Type: attack submarine, operated by United States Navy 2 of these ships sank!
Hello this is for my Java class project, thank you in advance Create the four data classes as diagram shown on the picture attached. Dont add any attributes or methods that don't appear in the UML diagrams. Create another, executable class named ShipTest as shown below to test these classes. ShipTest: make two objects with declared type Ship but actual type CruiseShip. make one object of declared type Ship but actual type CargoShip. make one object of declared type CargoShip and actual type CargoShip. make a ship of declared type WarShip and actual type WarShip. using the array initializer syntax, code all of these ships into an array of type Ship named fleet. code a for loop that processes the fleet array to show display all ships and their data. use a method of class Arrays to create an ArrayList of type Ship from the fleet array. pass this ArrayList to a method named shipShow that also displays all ships and returns an integer. report the value of the integer returned by shipShow. shipShow method: from the ArrayList, remove the CargoShip that was declared as type Ship. add another WarShip instance to the ArrayList. use a foreach loop to process the ArrayList and print the data for each ship. count the number of ships that are not afloat. Return this count to main for printing. SAMPLE OUTPUT AN ARRAY OF SHIPS IN MAIN Ship name: Magic, year launched: 1998, is afloat: true 2700 passenger capacity, operating in the Caribbean Ship name: Titanic, year launched: 1912, is afloat: false 1300 passenger capacity, operating in the Atlantic Ocean Ship name: El Faro, year launched: 1974, is afloat: false Capacity of containers is 391 Ship name: Seawise Giant, year launched: 1979, is afloat: false Capacity of crude oil is 564763 Ship name: USS Nimitz, year launched: 1972, is afloat: true Type: super carrier, operated by United States Navy ARRAYLIST OF SHIPS FROM A METHOD Ship name: Magic, year launched: 1998, is afloat: true 2700 passenger capacity, operating in the Caribbean Ship name: Titanic, year launched: 1912, is afloat: false 1300 passenger capacity, operating in the Atlantic Ocean Ship name: Seawise Giant, year launched: 1979, is afloat: false Capacity of crude oil is 564763 Ship name: USS Nimitz, year launched: 1972, is afloat: true Type: super carrier, operated by United States Navy Ship name: USS John Warner, year launched: 2015, is afloat: true Type: attack submarine, operated by United States Navy 2 of these ships sank!
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Hello this is for my Java class project, thank you in advance
Create the four data classes as diagram shown on the picture attached. Dont add any attributes or methods that don't appear in the UML diagrams. Create another, executable class named ShipTest as shown below to test these classes.
ShipTest:
- make two objects with declared type Ship but actual type CruiseShip.
- make one object of declared type Ship but actual type CargoShip.
- make one object of declared type CargoShip and actual type CargoShip.
- make a ship of declared type WarShip and actual type WarShip.
- using the array initializer syntax, code all of these ships into an array of type Ship named fleet.
- code a for loop that processes the fleet array to show display all ships and their data.
- use a method of class Arrays to create an ArrayList of type Ship from the fleet array.
- pass this ArrayList to a method named shipShow that also displays all ships and returns an integer.
- report the value of the integer returned by shipShow.
shipShow method:
- from the ArrayList, remove the CargoShip that was declared as type Ship.
- add another WarShip instance to the ArrayList.
- use a foreach loop to process the ArrayList and print the data for each ship.
- count the number of ships that are not afloat. Return this count to main for printing.
SAMPLE OUTPUT
AN ARRAY OF SHIPS IN MAIN
Ship name: Magic, year launched: 1998, is afloat: true
2700 passenger capacity, operating in the Caribbean
Ship name: Titanic, year launched: 1912, is afloat: false
1300 passenger capacity, operating in the Atlantic Ocean
Ship name: El Faro, year launched: 1974, is afloat: false
Capacity of containers is 391
Ship name: Seawise Giant, year launched: 1979, is afloat: false
Capacity of crude oil is 564763
Ship name: USS Nimitz, year launched: 1972, is afloat: true
Type: super carrier, operated by United States Navy
ARRAYLIST OF SHIPS FROM A METHOD
Ship name: Magic, year launched: 1998, is afloat: true
2700 passenger capacity, operating in the Caribbean
Ship name: Titanic, year launched: 1912, is afloat: false
1300 passenger capacity, operating in the Atlantic Ocean
Ship name: Seawise Giant, year launched: 1979, is afloat: false
Capacity of crude oil is 564763
Ship name: USS Nimitz, year launched: 1972, is afloat: true
Type: super carrier, operated by United States Navy
Ship name: USS John Warner, year launched: 2015, is afloat: true
Type: attack submarine, operated by United States Navy
2 of these ships sank!
![<<Java Class>>
© Ship
chap11new
o name: String
- year: int
o isAfoat: boolean
SShip(String.int,boolean)
isAfoat():boolean
o setAfoat(boolean):void
getName():String
o getYear():int
o toString():String
<«Java Class>>
<<Java Class>>
<«Java Class>>
©Cruise Ship
©WarShip
©CargoShip
chap11new
chap11new
chap11new
o passengers: int
o zone: String
SCruiseShip(String, int, boolean,int, String)
• getPassengers():int
getZone():String
o toString():String
o type: String
o nation: String
SWarShip(String, int, boolean, String, String)
toString():String
o cargo: String
сарacity: int
SCargoShip(String.int,boolean, String.int)
toString):String
getCapacity():int](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F9588d75b-96d3-4568-8e6a-ba35399bd189%2Ff9fe5ab9-0339-44ca-bba4-3b24ed25560e%2Fg1wgiad_processed.png&w=3840&q=75)
Transcribed Image Text:<<Java Class>>
© Ship
chap11new
o name: String
- year: int
o isAfoat: boolean
SShip(String.int,boolean)
isAfoat():boolean
o setAfoat(boolean):void
getName():String
o getYear():int
o toString():String
<«Java Class>>
<<Java Class>>
<«Java Class>>
©Cruise Ship
©WarShip
©CargoShip
chap11new
chap11new
chap11new
o passengers: int
o zone: String
SCruiseShip(String, int, boolean,int, String)
• getPassengers():int
getZone():String
o toString():String
o type: String
o nation: String
SWarShip(String, int, boolean, String, String)
toString():String
o cargo: String
сарacity: int
SCargoShip(String.int,boolean, String.int)
toString):String
getCapacity():int
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY