Draw a UML diagram of each of the Shapes, Rectangle and Square classes using the code that has been
provided. Complete this using the examples that have been provide in the lecture slides.
2. Draw a UML diagram of the ShapesList class using the code that has been provided. Complete this using the
examples that have been provide in the lecture slides.
3. Add appropriate comments into the file: ShapesList.java to explain all the methods. At a mimimum, explain the
purpose of each method. For the more complex methods reading input from a file, sorting the data and
exporting data to the file, insert comments to explain the code.
4. Explain in what the purpose of the call to hasNextLine() in readFromFile() in ShapesList.java.
5. Briefly explain the code in bubbleSort() in the ShapesList class. What attribute are the shapes being sorted by?
Name the sort algorithm that is being used. Explain in words how it works, using an example. Why do we need
to use two for loops?
6. Briefly name and describe one other sorting algorithm that could have been used.
7. Explain the use of the return value in the getArea() method in the Rectangle class. What is it returning? Where
does the value come from?
8. Examine the lines to open the output file and write the outputString in the ShapesList class:
File file = new File(“export.txt”);
System.out.println(file.getAbsolutePath());
output = new BufferedWriter(new FileWriter(file));
output.write(outputString);
Where is the output file located? Find BufferedWriter in the Java API documentation and describe the use of
this object.
9. Examine the code in the exportToFile method. What is the purpose of the ‘\r\n’ in the toString() method that is
used to produce the output string?
10. Briefly explain why a try and catch clause has been included in the code to read from the file. Remove this from
the code and remove the input file and take note of the error. Reâ€add the line and investigate what happens if
the input file is not present.
Use the UML diagram provided to implement the class Car in a file called Car.java. Ensure that you adhere to
the naming used below as this class will be used by other classes that you will develop. Starter code is provided
for you to copy.
2. Make sure that your Car class extends the Vehicle class.
3. Ensure that your class includes the following validation within the mutator (set) methods:
a. numSeats cannot be less than two. If an attempt is made to set the numSeats to an invalid amount,
then the method should set the numSeats to two and return false, otherwise set the numSeats as given
and return true.
b. The numDoors cannot be less than two. If an attempt is made to set the value of the numDoors to an
invalid value the method should return false.
4. Write additional methods for toString() and a method to check equality with another car (equality should be
based on vinNumber being the same for both vehicles).
5. Select two Cars that you will create. Choose values for each of the data attributes for each car. Write a class
called TestClass (starter code is provided to copy from) and within the main method write code that will :
a. Instantiate an instance of the Car class for one of the Cars you selected using the Car() constructor
b. Sets all of the instance variables to the appropriate values using the mutator methods (set)
c. Change the yearOfManufacture to increase the yearOfManufacture of the first Car by 5 years.
d. Instantiates an instance of the Class Car for a second different Car contained in the table below using
the Car(make:String, model:String, registration: String, vinNumber: String, yearOfManufacture: int,
numSeats:int, numDoors: int, hatch: boolean, tintedWindows: boolean,manual: boolean) constructor
e. Display both of the Cars that you have created using the toString() method
f. Display both of the Cars that you have created using individual accessor (get) methods in a print
statement
MyAssignmenthelp.com has become one of the top class MBA essay writing services in the USA. Students prefer hiring our essay writing service as we provide affordable services. Despite delivering services at a cheap rate, we never compromise with the quality of our services. We render best quality essay help on more than 100 subjects. Students prefer hiring us, as we deliver solutions on time and have provisions to assist them with fast assignment solutions. Hence, with continuous support from students, we have become one of the top essay writing companies.
Just share requirement and get customized Solution.
Orders
Overall Rating
Experts
Our writers make sure that all orders are submitted, prior to the deadline.
Using reliable plagiarism detection software, Turnitin.com.We only provide customized 100 percent original papers.
Feel free to contact our assignment writing services any time via phone, email or live chat. If you are unable to calculate word count online, ask our customer executives.
Our writers can provide you professional writing assistance on any subject at any level.
Our best price guarantee ensures that the features we offer cannot be matched by any of the competitors.
Get all your documents checked for plagiarism or duplicacy with us.
Get different kinds of essays typed in minutes with clicks.
Calculate your semester grades and cumulative GPa with our GPA Calculator.
Balance any chemical equation in minutes just by entering the formula.
Calculate the number of words and number of pages of all your academic documents.
Our Mission Client Satisfaction
Dear Expert Thank you for your service and support. The work was good, I got 72%.
Australia
WHAT AN FANTASTIC OUTCOME I RECEIVED!! My essay subject was very difficult with many parts! My MAH\'s expert NAILED IT!!!! thanks a million! I WILL BE BACK!
Australia
It was a very well done job. The writings are accurate and supported with reliable resources which were related to the assignment. It was done on time and quick service.
Australia
Hi, Received the grades for this assignment this morning. Good grades with some minor feedback. Professor is happy with the content, referencing and especially the way assignment was written. Please pass on my thanks and regards to the expert who did...
Australia