0% found this document useful (0 votes)
50 views

Programming Assignment No

This document provides instructions for a programming assignment to calculate the distance traveled by a javelin throw. Students are asked to write a Java program that takes measurements from two distance measuring devices and calculates the actual distance the javelin traveled. The input file contains rounds of throws with measurements, and the program should output the calculated distance for each throw by round. Submission instructions require groups of two students to submit both a hardcopy and softcopy of their coded solution with specific formatting and labeling requirements.

Uploaded by

Gran Martinez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

Programming Assignment No

This document provides instructions for a programming assignment to calculate the distance traveled by a javelin throw. Students are asked to write a Java program that takes measurements from two distance measuring devices and calculates the actual distance the javelin traveled. The input file contains rounds of throws with measurements, and the program should output the calculated distance for each throw by round. Submission instructions require groups of two students to submit both a hardcopy and softcopy of their coded solution with specific formatting and labeling requirements.

Uploaded by

Gran Martinez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ICSM152 Java Programming

First Programming Assignment

If it’s a Javelin, Duck!


Source: ACM Programming Practice Sets

Input File: javelin.in

The coaches for the US Olympic Track Team, Pierre A. Noid and Ada Noid, fear that their 16-year-old, 7’2” javelin
thrower, Moven van Driver, has not been given a “fair go” by the Olympic referees. They have purchased two
distance measuring devices (DMD) to help them check on the accuracy of the measurements made by the referees.
There are several elimination rounds for which each coach positions him/herself in either coaches area (which
includes the boundaries), such that the two coaches are on opposite sides of the throwing zone. At the beginning of
each round the coaches measure their separation from each other and the distance of each from the launching
point. During a round the coaches do not move. For each throw in each round they record their distances from the
landing point, and calculate the distance that should have been awarded to Moven. You may assume that the javelin
will always land somewhere in the landing area (which includes its boundary).

The following measurements are made, as indicated in the figure above:

x Pierre’s distance from the launching point


y Ada’s distance from the launching point
z Distance between Ada and Pierre
a Pierre’s distance from the javelin’s landing point.
c Ada’s distance from the javelin’s landing point.

Your program is to determine b, the actual distance traveled by the javelin (in meters, to the nearest hundredth of a
meter) from the other measurements (given in meters to the nearest hundredth of a meter).
Input
There will be several groups of input data, each representing a round. The first line of each group will have an
integer and three real numbers, n, x, y, and z separated by white space. The first number n is the number of throws
in the current round, such that 0 < n < 5. The other distance limits are 10 ≤ x ≤ 100, 10 ≤ y ≤ 100, and 5 ≤ z ≤
100. The next n lines will have pairs of real numbers, representing measurements a and c, such that 0 ≤ a ≤ 100, and
0 ≤ c ≤ 100. The input data is terminated by a value of n = 0, followed by three zeros and this data is not processed.

Output
The output should be labeled by the number of the round, and followed by the distance of each throw for that
round (each on a separate line). Formatting should be as in the sample output.

Sample Input
3 50.00 50.00 75.00
50.00 50.00
60.00 40.00
30.00 75.00
2 30.00 60.00 87.50
55.55 66.66
33.33 88.88
0000

Sample Output (corresponding to Sample Input)


Round 1
1. 66.14
2. 66.30
3. 69.96
Round 2
1. 52.77
2. 48.81

Submission Instruction

• To be solved/ accomplished by groups, each is composed of two (2) members.


• Deadline: Monday, July 5, 2010 (Preliminary Exam)
• Deliverables per group: (a) a hardcopy and (b) a soft copy of the code.
a. Format for the hardcopy. Font: Courier New. Size: 8. Margin: 0.5” on all sides.
b. All soft copies will be collected by the class beadle and submitted to the instructor. Single or separate
submission will NOT be accepted.
• Above your code, add a comment that gives the following data: subject code and section, school year and
semester, programming assignment number and title, filename, group members and program description.
• Filename Format: lastnameOfMember1_lastnameOfMember2_p1.java (e.g. aureus_pantoja_p1.java)
• Prepare for your first programming assignment defense. Technicalities will be announced soon.

You might also like