CS 1301 Program 1 Fall 2014


Design Due: Friday, Sept 5th by 11:59PM
Test Cases Due: Wednesday, Sept 10th by 11:59PM
Source Code Due: Friday, Sept 12th by 11:59PM,


Grading Criteria for Program 1 CS 1301 Fall 2014

Syntax checking- if it does not run without errors or warnings, it will not be graded
Program
Correctness
60

Introductory message

Gets data from user

Calculations are correct

Calculations are done in assignment statements (not output statements)

Math library function used correctly

Displays results correctly, both values, text and formatting (line breaks, etc.)
Testing 15

Test cases /15
Program Design 15

Individual design /15

Design and source code are NOT the same thing (10 point penalty!)
Style and
documentation
10

Prolog Comment with Name, Section, Email, Date, Purpose

Meaningful Variable Names

Documentation of Code

Source code Indentation/
   formatting/ whitespace
Total 100
Late Penalty

I have the authority to deduct points for other items which do not follow the program specifications, as given in the assignment page, or the documentation or other standards stated on the class web page.

Educational Goals: The educational goals of this program are that the student should use the concepts of

Imagine you work for an ATC (air traffic control) tower, located at point O (observer, see figure above). The radar system detects the distance from O to each of the two aircrafts - d1 and d2, as well as the angle theta. You are asked to determine distance D, given d1, d2 and theta.

The problem is an application of the Cosine Law.

The general case:

In our particular case, D can be computed as follows:

Sample interaction with the program:

----jGRASP exec: java program1
***ATC  computation***

Enter the distance between observer and aircraft one: 72
Enter the distance between observer and aircraft two: 50
Enter the angle theta between them: 49
The distance between the aircraft is: 54.40932816409653
 ----jGRASP: operation complete.

Another example run:

 ----jGRASP exec: java program1
***ATC  computation***

Enter the distance between observer and aircraft one: 50
Enter the distance between observer and aircraft two: 50
Enter the angle theta between them: 45
The distance between the aircraft is: 38.268343236508976
 ----jGRASP: operation complete.

Another example run:

 ----jGRASP exec: java program1
***ATC  computation***

Enter the distance between observer and aircraft one: 100
Enter the distance between observer and aircraft two: 100
Enter the angle theta between them: 360
The distance between the aircraft is: 0.0
 ----jGRASP: operation complete.

A few details

Please note that theta is measured in degrees. Java Math.cos() function takes arguments in radians not degrees. You need to convert the input from the user (given in degrees) to radians. This can be done in several ways, either way is acceptable.

Test Cases

First, read the assignment carefully. Look for how the program is supposed to behave. You do not know what the code looks like - that is fine. The assignment gives some examples of normal runs. There are other test cases needed.
Save this doc file and fill in the table with test cases. Put your name and the section at the top. Submit this file with your additions at the link here. Choose the menu choices of "TestCases" and "Program 1". This is due by Wednesday, September 10th, 11:59PM.

Design


Decide on what steps you will need to perform to solve this problem. Make a numbered list and put it in Java form. Save this Java file as "design1.java".
// supply program prolog
//  main function
    // 1. Display introductory message 
    // (some of your design here)
    // N. calculate distance between the aircrafts
    // (rest of design goes here)
    // M. output to the shell the distance
and individually fill in the missing steps in the design. The N and M will depend on how many steps you put in the design. There should be at least 8 steps in the design. Submit this file with the link here. Choose the menu choices of "Design" and "Program 1". This is due by Friday, September 5th, 11:59PM.

Implement the design

Write a Java program to implement your design. Make a copy of the Java file you have that has the design in it and write your Java code between the commented lines of the design. Make sure you eliminate any syntax and semantics errors. Here is where test cases come in handy! Submit your individual source code with the link here. Choose the menu choices of "Code" and "Program 1". This is due by Friday, September 12th, 11:59PM.

There are several specifications about how your program should be written.

Please read the documentation standard on the class web page. As you can see from looking at the grading criteria, we will be looking to see how you meet these standards. Note particularly that we require a prolog!

Remember that the program must run with NO errors or warnings. If it does not, it will not be graded!