Before continuing on, be sure you’ve completed each of the following steps to prepare your computer for the course’s programming assignments. This means installing the required software and setting up the course workspace. Instructions for this can be found here. Also make sure you’ve completed EX00 and the lectures through 6/3.
“Pulling” course materials down from Upstream. As new lesson material or starter code for exercises is added to our central course repository, these are the steps you’ll take to download them into your own workspace repository.
git pull origin main
. We are pulling code from the course source repo into our local repo.Right click on the src
directory and select “New Package.” Name your package ex01
. This is where the code for your first exercise will go.
Now, right click on your ex01
package and select “New Java Class” and name your class JavaWarmUp
. It is important that you name your classes exactly as specified in the write-up. You will be prompted to add this new file to Git. Click “Add.”
Within this class, JavaWarmUp
, is where you will want to define a main
method. This will be the entry point of your program. It is important that you define the main
method here, so that our grader will be able to properly execute your code!
At this point, you have a minimum viable set up for ex01, and you are ready to hit the ground running. For the remainder of the exercise you are free to design your program however you choose, so long as it meets the specifications outlined in part 3. This means given an input of the form described in part 3, it produces a report containing the information as shown in part 3. You can define any helper methods or helper classes that you think might be useful, but there is not one single expected solution.
Your program should read input that has the following form:
The first input will be an integer that indicates the number of sightings.
Following this will be information about each sighting on a single line with the following form:
MM/DD/YY HH:MM Shape Duration Latitude Longitude
Where…
MM/DD/YY represents a date.
HH:MM represents a time with hours and minutes in 24-hour format.
Shape represents a single word descriptor of the UFO shape.
Duration represents the duration of the sighting in seconds as an integer.
Latitude and Longitude represent the location of the sighting as real numbers.
Here is an example of what your input might look like:
5
10/15/36 17:00 cigar 181 61.458056 -149.362222
11/24/06 13:30 fireball 901 29.785556 -95.824167
7/18/10 1:16 light 2701 44.848056 -93.042500
3/7/14 20:45 light 121 26.525000 -80.066667
7/17/10 23:45 fireball 121 28.248611 -81.281389
Your program should produce a report that indicates:
The date, time, shape, and location of the sightings with the longest and shortest durations.
In case of ties, report the sighting that comes later in the input (not necessarily later by date, but simply later as provided to the program).
The average duration and location of sightings by shape.
Note: The average of the integer durations should be a real number. The average location is the average latitude and average longitude.
Here is an example of what your output might look like for the above input:
Longest sighting:
When: 7/18/10 1:16
Shape: light
Where: (44.85, -93.04)
Shortest sighting:
When: 7/17/10 23:45
Shape: fireball
Where: (28.25, -81.28)
Averages for cigar:
Duration: 181.00
Location: (61.46, -149.36)
Averages for fireball:
Duration: 511.00
Location: (29.02, -88.55)
Averages for light:
Duration: 1411.00
Location: (35.69, -86.55)
To read input, the final version of your program should make use of the Scanner
class, which we will go over in class on Friday. You are welcome to make use of the File
class while testing, which we will also go over on Friday.
Different sized data sets for you to practice on should be present in your workspace data
folder if step 1 completed successfully. When running your program, just paste the contents of the file into the console. I will show this on Friday! :)
Feel free to use Java documentation on the internet to help you! When getting up to speed on a new programming language this is the normal thing to do.
As mentioned in class, feel free to use any useful methods or search online for different Java resources/documentation to help you get up to speed and complete the assignment. For example, the String
methods on slide 16 of lecture 0 are fair game. If you use a substantial amount of code from any documentation website, please cite it in a comment.
The grader is very picky! To get full credit, make sure you are rounding correctly. See the posted piazza note for a hint about this. Also, to get the same indentation as in the sample output, make use of the tab escape sequence we saw in class to produce a tab.
“Push” your work up to GitHub for backup. By creating “commits”, which you can think of as versioned checkpoints in your workspace, you are not at risk of losing your work. It’s easy to revert back to an old version or to restore your entire workspace on a different computer.
main
branch, and needs to be pushed to your remote backup.USERNAME
with your GitHub username:
https://github.com/comp210-ss1-24/comp210-workspace-USERNAME
All that’s left now is to hand-in your work on Gradescope for grading!
Before doing so, you need to know that before an assignment’s deadline you can resubmit work as many times as you need to without penalty. Portions of assignments are autograded and will provide near-immediate feedback. We want you to resubmit as many times as it takes you in order to earn full autograding credit!
Login to Gradescope and select the assignment named “EX01 - Java Warmup” You’ll see an area to upload a zip file. To produce a zip file for autograding, return back to IntelliJ.
Along the bottom of your window, you should see an option to open a terminal integrated into IntelliJ.
Type the following command (all on a single line):
./submit.sh ex01
In the file explorer pane, look to find the zip file named “ex01_submission.zip”. If you right click on this file “Open in -> Finder” on Mac, the zip file’s location on your computer will open. Upload this file to Gradescope to submit your work for this exercise.
We are working on rewriting the script to work for Windows! Until then, please navigate to your course workspace in a File Explorer window. Then right click on the src
folder in your exercises directory and compress the directory into a zip folder. You can name it “ex01_submission.zip”
When you upload it to Gradescope, please delete any files that showed up in the src/
folder that were not actually part of ex01
.
Autograding will take a few moments to complete. For this exercise there will be no “human graded” component, but in future exercises and projects there will. Thus, you should expect to score 100 out of 100 possible points on this assignment. If there are issues reported, you are encouraged to try and resolve them and resubmit. If for any reason you aren’t receiving full credit and aren’t sure what to try next, come give us a visit in office hours!