Create a new Java project named Program 5 Trains. In this project, create a package named trainsDemo
Question:
Create a new Java project named Program 5 Trains. In this project, create a package named trainsDemo and put all 3 of the classes discussed below in this package
Include a header comment to EACH OF your files, as indicated in your instructions. Here's alinkDownload linkdescribing the header. Note that headers are not meant to be in Javadoc format.
Note that Javadoc IS required for this assignment. Remember to Javadoc all classes, fields, constructors, and methods.
- Create a Passenger class and be sure to followthis UMLDownload this UMLexactly
- Create a Train class and besure to followthis UMLDownload this UMLexactly
- Create a third class named Program5Trains. Overwrite the code in Program5Trains with a copy ofthisDownload thiscode into it... if it does not compile, you misnamed something. Make sure that all of your classes and members are named correctly, and make sure your package is named correctly. When run, it should matchthis text file'sDownload this text file'soutput EXACTLY. If it does not, modify your classes until it does.
- Make the following changes to Program5Trains.Note that you must make these changes in order!!!!
- Modify the Passenger named Harry to Harry Truman.
- Add a new Passenger to passengers named "A new passenger" who is traveling first class. Add only one line (a new line 24) and modify one line.
- Modify line 30 ONLY to append a tab and "on board!" to each passenger.
- Add a new line 45 that adds a new passenger named Doctor Suess who is not traveling first class to link.
- Add a new line 19 that creates a NumberFormat for percentages
- Add a new line 19 that creates a NumberFormat for currency
- Modify lines 53 and 54 to use the NumberFormats you created appropriately. This will make these lines excessively long, so continue on a new line for both of them.
- Replace line 59 (System.out.println("Bob Marley is "+(zelda.isPassengerOnTrain("Bob Marley")?"":"not ")+"on Zelda 550");) with code that does not use the ternary if (ie, the ? and :) but produces the same output. Use as many lines as are necessary.
Your Program5Trains.java, Train.java, and Passenger.java files.
From Note that Javadoc IS required for this assignment links. I couldn't added link so I put the pictures of those links.
1. this UML
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill