Write some code in a main method that creates media has


Problem 1.

An application tracks the amount that account owed for tolling charges. These charges are accrued when crossing a bridge. There are 3 types of accounts: one for cars, one for trucks and one for emergency vehicles. Cars have a person owner with a first and last name, a license plate, and an account number. When a car crossed a bridge the charge is $5. Trucks have a corporation owner, a license plate, and an account number. When a truck crosses the bridge, it is charged $3 per axle. Emergency vehicles are also in the system, but cross the bridge for free. These emergency vehicles have a government owner, an account number and a license plate.

Make classes for all types of vehicles, with all properties mentioned, using inheritance when possible. Each class should have a method that can be called when the vehicle crosses the bridge. The method should keep track of how much the account owes.

In addition to the classes, write some code in a main method that creates some vehicles, post some tolls and prints out their account balance. Your main method code should verify that the method called for each crossing accurately keeps the account balance.

Problem 2.

A library has many type of materials to lend to patrons. Books, videos and DVDs are three types of these materials. All three have titles, but books have an author while videos and DVD have a director. Each can be lent out to a partron for 10 days (books) or 20 days (videos or DVDs).

Make classes for the types of material along with a method that posts when the material was borrowed. That method should take a date and add the appropriate number of days and determine the due date properly of the material. The textbook covers date handling. Date is a class with specific properties and methods.

In addition to the classes, write some code in a main method that creates media, has them borrowed by patrons and correctly tracks the due date.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write some code in a main method that creates media has
Reference No:- TGS02393451

Now Priced at $10 (50% Discount)

Recommended (99%)

Rated (4.3/5)