<分区>
我目前正在我的大学学习初级 Java 类(class),并且仍在学习编程的基础知识。本周我们一直在学习构造函数,我被困在本周作业的后半部分,因此非常感谢任何帮助。
实验第二部分(我卡住的部分)的说明如下:
Write the complete code for the class Truck as given in the class diagram below. Be sure to not use duplicate code in the constructors. For example, the constructors with 2 arguments should call the one with 1 argument to set the value for cylinder.
这些是它要我制作的构造函数。
卡车()
卡车(int cylinders)
Truck(int cylinders, String manufacturer)
Truck(int cylinders, String manufacturer, double load)
Truck(int cylinders, String manufacturer, double load, 双拖)
任何关于如何做到这一点的解释/例子都会很棒