CS139 Algorithm Development

Software Requirements Specification

Programming Assignment 2

Physics

Due Friday, October 8 by 5:00pm


Introduction

Purpose: You are taking a physics class and there are SOOOO many formulas to use. As a CS 139 student, you have used the Math class functions and have found them to be pretty handy. So, you decide to make a Physics class that will contain methods to help you with those formulas.This program will result in a Physics class and also introduces you to a new concept, the checkExpect.

Objectives - At the conclusion of this exercise the student will demonstrate that they can:

Deadlines

Prerequisites

You have covered the material in Chapter 5 of Gaddis.  

Program Behavior

The driver program, PhysicsTester.java, contains a main method that will run each of the methods in Physics, and produce output that indicates whether your methods conformed to the expected behavior.  Method headers containing the name of the method, input parameters, and return type are found in the file, Physics.java. You must use these headers.

Physics Methods

There are a lot of formulas to describe various kinds of motion in physics. We have just a few here; you may add additional methods if you like to your Physics program.  Your program must be able to calculate the following:

In addition to the physics method, we want a helper method that can be used to take the long numbers returned by the physics methods and return a formatted String. This method will take in a double value and a precision and will return a number formatted to the given precision. This will save us from having to create DecimalFormat objects or to use String.format for each value we want to output.

Output

You do not need to worry about formatting the output. The only formatting that you will be doing is to produce a String representation of a double number to the number of decimal places prescribed.

Error Handling

The methods do not need to worry about error handling.

Additional Program Requirements

  1. You must use the method headers as provided in the Physics.java file.
  2. Your program must conform to standard Java programming standards and the additional standards for this class. See the Style Guide for your class. You must document each of your methods using the standard method formats.
  3. You must create a program called MyTester which will be copied from the PhysicsTesterthat we provide, but should include more tests for each of your methods.  This program will be attached to your successful pdf report and may be printed from your editor. It will not be evaluated for conformance to style, but instead will be evaluated for the quality of your test cases.

Honor Code

This work must conform to the JMU Honor Code and the specific requirements of this class. NO help may be provided by any student to another student. Authorized help is limited to your textbook, the TAs for any CS139 section, and the professor for your section. See collaboration policy.

Grading

        For submissions after:

HINTS