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 17:00
Match the following. 1. show grouping of word processing tasks that can be performed quick access toolbar 2. shortcut location for commonly used elements scroll bars 3. organized commands used to modify documents ribbon 4. used to align and measure content in a word screen zoom bar 5. vertical and horizontal bars that are used to navigate through a document contextual tabs 6. displays the name of the document in use ruler 7. allows users to enlarge or shrink a visual of a word document title bar
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
You know the right answer?
Chapter 10. pc #10. ship, cruiseship, and cargoship classes (read instructions carefully) design a s...
Questions
question
Mathematics, 30.10.2019 19:31