The program should be able to register two types of car owners: people and businesses. For both owners, following should be registered:
For the car owners that's people, following should be registered:
For the car owners that's companies, following should instead be registered:
For each car, following data should be registered:
Operations to be performed by the program:
For each of the registration operations relevant data is read from the user. Social Security will identify individuals and business registration number to identify the firms. Upon registration of a new car owner the program have to prevent the new owner gets the same person or enterprise number as a car owner that has already been registered by the program. Similarly, the characteristics of cars identify vehicles, so the program must prevent double registration of the same type of car.
In the case of ownership, the program must read inputted registration number of a car that will change owner, as well as personal or business registration number for a new owner. If the new owner is not registered in the past, it must be registered before ownership can be implemented. Any reading of the data shall be made the "safe" way, ie using try-catch (Note: Use try-catch with resources!) And/or test that the text fields for the required data is filled out.
Each time the application is completed, all data stored in the application's data structure is printed to a file for storage. At startup, any file with the stored data is read and placed in the application's data structure. (Use object serialization, and, respectively, ObjectOutputStream and ObjectInputStream when printing to file and reading from file and programs separate window to listen.)
It is a requirement in this paper that for car owners to define a class hierarchy with an abstract class that contains what is common to both types of car owners, while they are defined by non-abstract subclasses of the abstract class. For the register of car owners do not use array as data structure, but instead should be made a separate list class that contains the list of car owners and methods that make the necessary operations on this list.
You will now create a new and expanded version of the program you made in a). In this version, it should be possible for every car owner to own more cars, with no limit on how many it is. Otherwise, the same data should be recorded.When printing the car registry, all data from cars a car owner owns should be printed. To avoid double registration of car owners, you should organize your application's data structure in the form of a list of lists. This means that in addition to the class list for car owners to generate a corresponding list for the class of cars, so that every car owner object has its own car list object. This includes vehicles owned by that car owner. (The list will be empty if they do not own any car at the moment.)