Your instructor will assign one or more of the following problems. Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files.
Design and build a class hierarchy for media types. Your hierarchy should support Books, Periodicals, DVDs and CDs.
Some attributes for these kinds of objects include: title, author, ISBN number, subject, running time, volume
number, rating, and lending length. Store each of these attributes in the appropriate place in the hierarchy and
override the
toString()
method of each class in an appropriate manner.
Write a program that creates an array of media types and uses that to demonstrate the correctness of your design and implementation. One way to do this would be to write a console-based driver that does the following:
Design and build a class hierarchy for types of vehicles that can be used by a travel agent to build trip itineraries. Your hierarchy should include cars, airplanes, rental cars and bicycles. Here's an example of the output for a 4-step itinerary:
Business trip for Brenda Doe: 1. Drive to GRR airport. Volkswagon Golf 10.0 miles 0.20 hours 2. Fly to OHR airport non-stop. Boeing 777 200.0 miles 2.40 hours 3. Fly to RNO airport non-stop. Airbus A319 2000.0 miles 5.81 hours 4. Drive to Lake Tahoe. Jeep Commander 55.0 miles 1.60 hours Total Distance: 2265.0 miles Total Time: 10.01 hours Have a safe trip.
This output can be generated using the following pre-built classes:
Start with these two classes and add the following classes:
Note the following things:
getDistance()
, getTime()
,
toString()
).
getName()
,
getTime()
, getDescription()
).
Daily commute for Keith Doe: 1. Bike to the office. (Consider driving if icy.) Trek 730 3.0 miles 0.15 hours Total Distance: 3.0 miles Total Time: 0.15 hours Have a safe trip. Daily commute for Keith Doe: 1. Drive to the office. (Consider bicycling.) Volkswagon Golf 3.0 miles 0.06 hours Total Distance: 3.0 miles Total Time: 0.06 hours Have a safe trip.
Design and build a class hierarchy for shapes. Your hierarchy should support circles, ovals, triangles, right triangles, squares, rectangles, quadrilaterals. Each class should have appropriate attributes in order to be able to determine: the smallest rectangle that bounds the shape, the area of the shape, the circumference of the shape, whether a point is inside the shape, and whether two shapes bounding rectangles intersect.
Store the hierarchy in a package and then write a program that creates an array of shape types and uses that to demonstrate the correctness of your design and implementation.
Submit all appropriate files for grading, including code files, screen captures, supplemental files (e.g., image files), and text files. We will grade this exercise according to the following criteria:
If you work in teams for this homework assignment, be sure to submit all team members’ names in the code documentation.