subject
Computers and Technology, 29.06.2019 12:20 nisha87

Chapter 10. pc #10. ship, cruiseship, and cargoship classes (read instructions carefully) design a ship class that the following members: • a field for the name of the ship (a string). • a field for the year that the ship was built (a string). • a constructor and appropriate accessors and mutators. • a tostring method that displays the ship’s name and the year it was built. design a cruiseship class that extends the ship class. the cruiseship class should have the following members: • a field for the maximum number of passengers (an int). • a constructor and appropriate accessors and mutators. • a tostring method that overrides the tostring method in the base class. the cruiseship class’s tostring method should display only the ship’s name and the maximum number of passengers. design a cargoship class that extends the ship class. the cargoship class should have the following members: • a field for the cargo capacity in tonnage (an int). • a constructor and appropriate accessors and mutators. • a tostring method that overrides the tostring method in the base class. the cargoship class’s tostring method should display only the ship’s name and the ship’s cargo capacity. in the main class, you should read the input file and create an array containing ship, cargoship, cruiseship objects based on the information provided on each line. the file is in csv (comma separated values) format. this means each line contains multiple data elements separated by comma. you can use scanner class to input the data or if you know how to work with stringtokenizer you can also use it. another option is to use the split() method in the string class. the first column in the file contains the ship type (“ship”, “cruiseship”, or “cargoship”) as a string. the second column contains the ship name as a string. the third column contains year built as a string. the forth column contains different information for different ship types: for ship type = “ship” - empty (ignore) for ship type=”cargoship” - cargo capacity (int) for ship type=”cruiseship” - max passengers (int)in java language. ouputcruise ship\n ship name: aegean spirit\n year built: 2003\n max passengers: 4,500\nstandard ship\n ship name: classica\n year built: 1990\ncargo ship\n ship name: edith maersk\n year built: 2007\n cargo capacity: 170,794\ncargo ship\n ship name: emma maersk\n year built: 2006\n cargo capacity: 156,907\ncruise ship\n ship name: enchanted capri\n year built: 1970\n max passengers: 7,000\ncargo ship\n ship name: estelle maersk\n year built: 2006\n cargo capacity: 151,687\ncruise ship\n ship name: explorer of the seas\n year built: 2001\n max passengers: 9,500\nstandard ship\n ship name: mv delight\n year built: 1985\ncargo ship\n ship name: ocean glory\n year built: 2006\n cargo capacity: 161,788\ncruise ship\n ship name: our lady\n year built: 1960\n max passengers: 3,500\nstandard ship\n ship name: provence\n year built: 1995\nstandard ship\n ship name: ss desabla\n year built: 1913\ncruise ship\n ship name: symphony\n year built: 2001\n max passengers: 10,000\n

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Acetylene is a gas which burns rapidly on its own, and is considered highly explosive. a) true b) false
Answers: 2
question
Computers and Technology, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
You know the right answer?
Chapter 10. pc #10. ship, cruiseship, and cargoship classes (read instructions carefully) design a s...
Questions
Questions on the website: 13722359