Computers and Technology
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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 08:50, bo4isbad
Write a program that will compute the volume of ice cream served in a cone. as you can see in the diagram below, the ice cream is served as a hemisphere of frozen deliciousness on top of a cone, which is also packed with frozen deliciousness. thus, the total volume of ice cream sold is the volume of the hemisphere plus the volume of the cone. the example shows an ice cream cone in which the hemisphere and cone have a radius of 10 inches and the cone has a height of 15 inches. your program must instead prompt for these two values, which are taken from the keyboard as integers: • the hemisphere/cone radius in inches, and
Answers: 3
image
Computers and Technology, 24.06.2019 11:00, soystersoce
Under the home tab, where can a user find options to change the bullet style of an outline? in the slides group in the font group in the paragraph group in the drawing group
Answers: 1
image
Computers and Technology, 24.06.2019 11:20, isabelperez063
Every telecommunication setup uses two devices: one device to transmit data and one device to receive data. which device transmits frequencies to mobile phones? towers transmit frequencies to mobile phones.
Answers: 1
image
Computers and Technology, 25.06.2019 01:30, kalag9478
If the average computer chip had 1,200 transistors per square inch in 1970, approximately how many transistors per square inch would one have in 1976? use moore's law to calculate your answer
Answers: 1
Do you know the correct answer?
Chapter 10. pc #10. ship, cruiseship, and cargoship classes (read instructions carefully) design a s...

Questions in other subjects:

Konu
Mathematics, 19.05.2020 20:05