Exercise Monday

Goal: Familiarize yourself with concepts from the pre-work. While many concepts may be similar to those you learned in Intro to Programming, pay special attention to the Java-specific approaches. This course will cover a lot of ground; so take advantage of this time to ensure you're comfortable with the basics before we pick up speed!

Warm Up

  • What command runs an application?
  • What is a member variable?
  • How can we tell if something is a primitive?
  • What can't we do with primitives?


Meal Time

Let's start small, by simply reviewing concepts from this weekend's homework. Follow along with the Writing Custom Methods lesson to create the Meal Time application.


Next up, continue your review of the weekend homework by following along with the lessons listed below to create the Car Dealership application!

Triangle Tracker

When you and your pair feel fairly comfortable integrating custom classes into Java applications, create another application that creates and evaluates triangles based on user-provided input.

  • Create a Triangle class.
  • Write a command line interface that allows users to input lengths for the 3 sides.
  • Create a Triangle object using these lengths.
  • Write a method in the Triangle class that returns whether the lengths form an equilateral, isosceles, or scalene triangle. If you're not familiar with these terms, here are definitions:
    • Equilateral: All sides are equal.
    • Isosceles: Exactly 2 sides are equal.
    • Scalene: No sides are equal.

Also, keep in mind that not all combinations of three numbers make valid triangles! For example, (2, 2, 8) does not make a triangle. If any one side is longer than the other two combined, the lengths cannot form a triangle.

CD Store

Create a command line interface application for a music store that sells CDs. The application should use a while loop to continually run until the user opts to exit. (As seen in this lesson.) Users should be able to:

  • Create a new CD object by providing an artist name, album name, release year, and price.
  • See a list of all CDs currently in the store's inventory.
  • Search for CDs based on their release year.
  • Search based on price range.
  • Search based on artist.


Create a basic application that prompts users to provide the dimensions and weight of a package. Then, return the cost to ship the package

  • Create a Parcel class.
  • You should be able to create a new Parcel and specify the dimensions and weight in the arguments.
  • Create a volume() method that calculates the volume of a Parcel using its dimensions.
  • Once you're able to successfully calculate volume, create a costToShip() method that returns how much this Parcel will cost to ship somewhere.
    • You should offer users different options for speed of delivery, distance, dimensions, and weight ranges to choose from.
    • Your formula should take these options into account, and calculate a cost to ship accordingly (for instance, a heavier package should cost more to ship than a lighter package. It should cost more for one-day shipping than five-day shipping, etc.)
  • Offer gift wrapping services that require the surface area of the Parcel to determine cost (ie: A Parcel with a surface area of 36 inches should cost less to add gift wrapping to than one with a surface area of 108 inches) The cost for gift wrapping should be added to the total shipping cost.
  • Consider offering discounts based on size, date or some other property of your choosing.
  • Add functionality to your command line interface that allows your program to continually run.
  • Allow users to ship multiple parcels in one "session". Keep track of each, and provide the user a "receipt" listing all Parcels they have shipped, the extra options (like gift wrapping) they've included, and the cost.
  • (Note: Until we integrate databases in week 3, we won't be able to retain data if we quit and re-start a program. This is normal.)

Peer Code Review

  • Is logic easy to understand?
  • Does the code and Git documentation follow best practices? (descriptive variables names, proper indentation, detailed commit messages, well-formatted README.)
  • Do application(s) work as expected?