Preparing your design workspace

Loading the problem and your saved attempt…

Design an Abstract Car Class

Define a small abstract car model with shared naming rules and descriptions that vary by car kind.

An assessment recollection names an abstract car class but gives no original methods or requirements. The following is a bounded object-modeling practice adaptation.

For this exercise, assume a client constructs petrol cars and electric cars, each with a display name. The client must be able to read the original display name and an energy description through an abstract car type. The descriptions are petrol and electric respectively.

Reading a description must not require the client to inspect the concrete car kind.

For this exercise, assume a blank name, including whitespace-only text, is rejected during construction. A valid name is preserved exactly, and the name and energy description do not change after construction. The abstract car type itself cannot be instantiated.

Design the object model, public contracts, and interactions for construction and reading. Describe one failed construction as well as a successful read through the common type. This exercise asks for a design; implementation is not required.

Its scope is one in-memory library with construction and read-only descriptions.

For the follow-up, assume a hybrid car is added with the same naming rules and the energy description hybrid. Explain how it joins the existing model and how you would test the extension.