OBJECTIVES After finishing this lab students can have the fo

OBJECTIVES
After finishing this lab, students can have the following:
Understand how to declare an unsorted-optimized array data structure
Know how to insert nodes to the structure, fetch a node with a key field of node, update the information of a node and delete a node from the structure
Verify that the nodes in the unsorted-optimized array data structure are fully encapsulated.
Students will be familiar with the ArrayList and apply all the basic operation to access nodes
Also, students recognize that ArrayList is a heterogeneous data structure that can store nodes of any type of objects.
REQUIREMENT STATEMENT
A car dealer needs an application that can help the shop to do the following tasks:
1. Insert a car or a motocycle
2. Test for the encapsulation of the data structure
3. Remove a car or a motocycle
4. Update information of a car or a motocycle
5. Show All vehicles
6. Exit
Also, the owner of the shop asks for:
-Using the Unsorted Optimized Array data structure for the application and apply Inheritance and polymorphism of Object Oriented Programming
-Requiement for output:
The car’s information is displayed as below (for example)
Car make: Toyota
Model: Sienna
VIN: 123A456B
Color: White
Year: 2014
Number of passengers: 8
Number of doors: 4
The motocycle’s information is displayed as below (for example
Motocycle make: Honda
Model: PCX150
VIN: 321BC654
Color: Grey
Year: 2015
Has side car: no
-After a task from the menu, the application should allow users to continue using the application and only terminate when users select Exit

TASK INSERT
-Display the message: “*** TASK: INSERT and FETCH A CAR OR A MOTOCYCLE ***”
-Allow users to enter the information of a car or a motocyle from the keyboard
-Insert the car/motocycle to the data structure
-Fetch the information of car/motocycle by its VIN from the data structure that have entered to the structure to ensure that the car/motocycle is in the structure
TEST FOR ENCAPSULATION
-Display the message: “*** TASK: TEST FOR DATA ENCAPSULATION ***”
-Create a test car with the following information typed from the keyboard:
-Insert this test car to the data structure
-Modify the the color of the test car with different color -Declare an object of car named “copy” and assign the node that is fetched from the data structure with the target key as FA15222
-Display information of the object named copy
-Compare the color of test car with the color of object copy. If they are different then display the message: “The Unsorted Optimized Array structure has the encapsulation”; otherwise display “The Unsorted Optimized Array structure does not have the encapsulation”
TASK UPDATE
-Display: “***TASK: UPDATE INFORMATION OF A CAR OR A MOTOCYCLE *** “
-Create an object of class Car named newNode
-Fetch a node with the VIN is the same VIN of test car then assign to newNode, therefore, the newNode has the same VIN with the test car
-Change the color of the newNode to different color
-Update the data structure with with the newNode
-Fetch with the key as the key of test car. If the node resulted from fetch has different color from the test car the display the message “Update test car successfully”; otherwise display “Update test car failed”
TASK DELETE
-Display: “ *** TASK: DELETE A CAR OR A MOTOCYCLE ***”
-Delete the node with the VIN as FA2016 that was not inserted to the data structure, print out the result of task delete (output: false)
-Delete the node with the VIN of the above test car, print the result (output: true)
-Fetch with the key as the VIN of the test car, print out the result (output: null)
TASK SHOW ALL
-Call showAll to display all nodes on the data structure
WHAT WE NEED TO KNOW TO DO THE PROGRAM
-Review how to declare the Inheritance relationship between 2 classes
-How to write the constructor, toString or other methods of child classes to inherit from the super class
-How to apply polymorphism to the main
-Understand what is Unsorted Optimized Array structure, how initialize the Unsorted Optimized Array data structure
-How 4 operations of Unsorted Optimized Array structure work
UML and PSUEDO-CODE
You should provide the UML of super class, and 2 child classes

The pseudo-code is provided in the requirement, you do not need to rewrite; just follow step by step to write the code
HOW TO DO THE LAB part1
-After provide UML and read the pseudo-code, start the Java editor
-Create the project name FA2016LAB3_PART1_yourLastname
-Add super class named FA2016LAB3_Vehicle_yourLastname that maintain Vin number, color, make, model, year. It also has some methods, such as, mutator, accessor, and toString, method forward (accept the amount of distance in miles, for example, 25, then display “move forward 25 miles”), method backward (accept the amount of distance in miles, for example 3 then display the message “move backward 3 miles”), turn left (display word “Turn left”) and turn right (display word “Turn Rright”)
-Add child class named FA2016LAB3_Car_yourLastName inherits from above class Vehicle. It has more data members, such as, number of passengers, number of doors
-Add child class named FA2016LAB3_Motocycle_yourLastName inherits from above class Vehicle. It has more data members, such as, has side car (boolean)
-Add a data structure class named FA2016LAB3_VehicleUnsortedOptimizedArray_yourLastName that maintain size(int), a vehicle array and next (int) to hold the location where the new node is inserted to the structure. Also, the class has the methods for 4 operations: insert, fetch, delete, update and showAll that display all the nodes in the structure. ( see the code on page 103 for your reference)
-Add a driver class name FA2016LAB3_VehicleDealerShop_yourLastname that do the requirement asking for
PART2: OBJECTIVES: Practice using Java ArrayList class.
REQUIREMENT and HOW TO DO THE LAB PART2
Add the following part to the previous project with the following step by strep (pseudo-code)
-Declare a data structure of ArrayList with the size 25
-Insert 3 cars/motocycles with information that are entered from the keyboard
-Show all 3 nodes that have inserted to the ArrayList data structure
-Use a for loop to insert number 1 to 100 to the above data structure of ArrayList
-Display the size of the above ArrayList.
-Remove the one above car/motocycle from the ArrayList data structure with one of the VIN displyed at above showAll(). Then display the size of the ArrayList structure
-Get and display the information of nodes at the location 52. Change the value at location 52 to 2016. Display the information at location 52 again
-Use JOptionPane to display the message: “Congratulation! You are successful on ArrayList with four operations: add, get, remove and set”

Solution

int main( int argc, char* const argv[] )

range of lines here

           for(int i = 0; i < num_lines; ++i)dissect and store all strings

               size = findIndex(line, \'|\');

               strncpy(name, line, size);

               index = size + 1;

               size = findIndex(line + index, \'|\');

               strncpy(time, line + index, size);

               index += size + 1;

               size = findIndex(line + index, \'|\');

               strncpy(cost, line + index, size);

           }

           in.close();

       }

       else

OBJECTIVES After finishing this lab, students can have the following: Understand how to declare an unsorted-optimized array data structure Know how to insert no
OBJECTIVES After finishing this lab, students can have the following: Understand how to declare an unsorted-optimized array data structure Know how to insert no
OBJECTIVES After finishing this lab, students can have the following: Understand how to declare an unsorted-optimized array data structure Know how to insert no

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site