Ask coding questions

← Back to all posts
Help with placement of code into Main()

I'm kinda new to java so I'm a bit confused on where to place my code into main to get the program to work. It runs with no errors, but I've been struggling to get the programs to work with multiple classes/files.

My prompt for this program is:
Create a class called Vehicle that has the manufacturer’s name (type String), number of
cylinders in the engine (type int), and owner (type Person given next). Then, create a class
called Truck that is derived from Vehicle and has the following additional properties: the load
capacity in tons (type double since it may contain a fractional part) and towing capacity in
pounds (type int). Be sure your class has a reasonable complement of constructors, accessor and mutator methods, and suitably defined equals and toString methods. Write a program to test all your methods.