Solution 1 2 3 4 5 6 7 8 9 10 11 12 13 File Author Description Travelable double toDistance Waypoint otherWaypoint double
Solution File Author Description Travelable double toDistance Waypoint
Solution File Author Description Travelable double
Author Description Travelable double toDistance Waypoint otherWaypoint double
Solution File Author Description Travelable
double toDistance Waypoint otherWaypoint double
Solution File Author Description
Solution File
(Solution) 1 2 3 4 5 6 7 8 9 10 11 12 13 // File: // Author: // Description: // // // // Travelable. double toDistance(Waypoint otherWaypoint) double...

Category: General
Words: 1050
Amount: $12
Writer:

Paper instructions

We have previously completed the Travel.java program as well as the Waypoint class and Travelable interface. The source code to all of these is published in the Resources area here. Modify my versions of Waypoint (to make it public and Serializable) and Travelable (to make it public), but don't attach those results (I will just use my own copies). In the chapter on File I/O (and my lectures) we discussed how to read and write objects through object input and output streams. Modify the previous Travel.java program and save it as the new RouteApp.java program, but with the following changes: Have your main method read in any previously saved route (if the route.ser file exists) using object I/O and then enter a main input loop to present a menu of choices to the user, as in the example near the end of the textbook chapter, but don't create a separate enum class to accomplish this (as in the example), just let the user choose to 1) add 2) change or 3) print the list of waypoints, or else just 4) exit the application. If the user chooses 1, call an add method that does pretty much what the old Travel program did previously to create a list of waypoints, except this time make sure to store them as an array (static) or ArrayList (dynamic) of waypoints (using our earlier work with arrays and lists). Be able to hold at least 10 waypoints in the array (I won't test for more than this). When the user finishes entering data, the speed of the last waypoint should be zero (just like before - that's how you know to end the add mode) and your main loop should display the menu again. Note that if a previous list already existed (because either a route was read in from the route.ser file when the program started or because the user previously selected the menu add item while running the program during this session, just overwrite the previous list with the new one. If the user chooses 2, call a change method that prompts them for the number of the waypoint to change, then lets them enter the new data (all four items) to replace the values in the old waypoint. After updating the route, present the main menu again. If the new waypoint has a speed of 0, delete all of the following waypoints in the list as this waypoint will now be the last waypoint in the route. If the waypoint that was previously the last one has its speed changed to a positive (non-zero) value, then after accepting the new data, immediately call the add method to continue building the remainder of the list. If the user chooses 3, call a print method that prints the route as a numbered list of the waypoints in the route (using the toString method of class Waypoint) to the console. The numbering used in this list should start at 1 and this is also the number that should be used to identify which waypoint to change using the second menu item (above). The print option should conclude with the distance and time statistics as in the previous Travel program. Finally, the main loop should present the menu again. If the user chooses 4, save each Waypoint in the array or list to a file called route.ser (overwriting any previous file) using Java Object I/O and then exit. Note, do not write the entire array or list as one, single object to the file. Each Waypoint object (element in the array or list) should be written seperately to the file. Attach only the source code for RouteApp.java (make sure you spell, case, comment and indent the source code correctly as well as name the variables and data files correctly in your code - don't send me any data files, however). I will compile and test your solution. It must compile for any credit (so watch your use of naming and casing to be sure they remain compatible with these specifications as well as the currently posted solutions). For extra credit, instead of attaching the RouteApp.java solution, attach a RouteMgr.java solution that works the same way except for the way it starts. For RouteMgr, if the user enters the name of a file on the command line when they run the program, as in: java RouteMgr myroute.data and the file myroute.data exists (in the current working directory), then assume that file is a correctly formatted plain text file with the waypoint fields listed, one set per row (x, y, speed and street - all delimited by white space with no imbedded spaces in the street names) and use that to initialize the internal arrays instead of the route.ser file, otherwise, everything else works the same way and the route.ser file will still be updated, as usual, upon exit. I can't attach two files so below is another file: // 2 // 3 // 4 // 5 // 6 // 7 // File: Author: Description: Travelable.java Instructor's Solution Lab assignment for Chapters 9, 10 - Inheritance, Polymorphism Create a Travelable interface requiring: double toDistance(Waypoint otherWaypoint) double toTime(Waypoint otherWaypoint) methods. 89 interface Travelable 10 { 11 public double toDistance(Waypoint otherWaypoint); 12 public double toTime(Waypoint otherWaypoint); 13 }1 // File: Travelable.java 2 // Author: Instructor's Solution 3 // Description: Lab assignment for Chapters 9, 10 - Inheritance, Polymorphism 4 // Create a Travelable interface requiring: 5 // double toDistance(Waypoint otherWaypoint) 6 // double toTime(Waypoint otherWaypoint) 7 // methods. 8 9 interface Travelable 10 { 11 public double toDistance(Waypoint otherWaypoint); 12 public double toTime(Waypoint otherWaypoint); 13 }

Answer

Get Essay Answer
1,200,000+ Questions
Satisfaction guaranteed
(Solution) #1a) def has_duplicates(c): for element in (c)appears more than once return true else return false def has_duplicates(filename): 'checks whether file...
(Solution) (25 points) Design, implement and test a Java application that will read a file containing data related to the passengers on the Titanic. The...
(Solution) As you know, credit card fraud is epidemic and many people are trying their best to steal your money. The tool you will be creating is a first step...
(Solution) Assignment No.2 Of MTH001 (Spring 2012) Maximum Marks: 20 Due Date: june25, 2012 DON'T MISS THESE: Try to get the concepts, consolidate your concepts...