Question: Java+ DataBase A train. Define the hierarchy of cars and locomotives. Create multiple objects. Assemble a train with a determination of its total carrying capacity

Java+ DataBase

A train. Define the hierarchy of cars and locomotives. Create multiple objects. Assemble a train with a determination of its total carrying capacity or the number of passengers

You must create three classes: train, wagon, passenger. In the console, you must specify three directions: 1add, 2check, 3remove (the user enters only a number).

1. Through the console, enter any passenger name and assign him a wagon(10 pieces) and a seat (in each wagon 20 seats). All this must be stored in the database. If space is already occupied, display "Occupied." After that, display the general information in the console in the form of table information about each wagon.

For example:

console:

Erik

5

17

output: Cars Passengers 1 0 2 0 3 2 4 full 5 +1 (17 seat)

...

2. Through the console, the number of the wagon and the place are entered. If someone is sitting there, get his name. If not, output "empty" 3. Through the console, remove the passenger by entering the wagon number and seat. you can then assign a new name. If not, output "empty."

Requirements:

1. Use only standard compilers and libraries.

2. When coding, conventions on the design of the code for the corresponding language should be used - code convention.

3. Use the capabilities of OOP: classes, inheritance, polymorphism, encapsulation.

4. Do not use the graphical interface! The application must be console.

5. Work with the console or the console menu should be minimal, since the MAIN OBJECTIVE of the TASK is to CHECK OOP PERCEPTION.

6. Use external data sources: files, DBMS

7. Transfer initialization data of objects using a constructor, function, or method (for example, for Java: Student ob = new Student (456543, 19, "Smith"); Or use database repositories

8. Provide only the source code of the application. In addition, it is possible to explain in a free but concise form what was done and why. Comment the whole code

9. Also, to complete the task, you need to study relational databases and SQL.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!