Здравейте колеги, малко помощ можели
това е моето решение стигнах до някъде и блокирах
Define two classes Car and Engine. A Car has a model, engine, weight and color. An Engine has model, power, displacement and efficiency. A Car’s weight and color and its Engine’s displacements and efficiency are optional.
On the first line you will read a number N which will specify how many lines of engines you will receive, on each of the next N lines you will receive information about an Engine in the following format “<Model> <Power> <Displacement> <Efficiency>”. After the lines with engines, on the next line you will receive a number M – specifying the number of Cars that will follow, on each of the next M lines information about a Car will follow in the following format “<Model> <Engine> <Weight> <Color>”, where the engine in the format will be the model of an existing Engine. When creating the object for a Car, you should keep a reference to the real engine in it, instead of just the engine’s model, note that the optional properties might be missing from the formats.
Your task is to print each car (in the order you received them) and its information in the format defined bellow, if any of the optional fields has not been given print “n/a” in its place instead:
Define the magic method __toString() to have a reusable way of displaying the objects.
V8-101 220 50
V4-33 140 28 B
FordFocus V4-33 1300 Silver
VolkswagenGolf V4-33 Orange
DSL-10 280 B
V7-55 200 35
DSL-13 305 55 A+
V7-54 190 30 D
FordMondeo DSL-13 Purple
VolkswagenPolo V7-54 1200 Yellow
VolkswagenPassat DSL-10 1375 Blue