EX01 – Java Warm-up!

0. Complete the Prerequisites

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.

1. Download New Course Material

“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.

  1. Open the Git menu from along the top and select Pull
  2. This downloads the latest course materials! It will succeed silently, so if nothing appears to happen it worked (and any new files will be available in the file explorer). If there was an error, you would see an error message pop up.

2. Set up your main class

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.

3. Write a program to process information about UFO sightings.

Your program should read input that has the following form:

Where…

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:

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)

Hints and Notes:

4. Make a Backup Checkpoint “Commit”

“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.

  1. Select the Git menu along the top of your screen and then choose “Commit”.
  2. Notice the files listed under Changes. These are files you’ve made modifications to since your last backup.
  3. Ensure all the files that you’d like to backup are selected. Your cursor should be inside of a message box where you will write a nice description of the modifications you’ve made to your code, like “Finished EX01!”, and then hit the “Commit” button.
  4. If you open the Git at the bottom of your screen, you should see this commit added to your chain of git commits. However, it has just been added to your local main branch, and needs to be pushed to your remote backup.
  5. Select the Git menu along the top of your screen again and then choose “Push”.
  6. A pop-up should appear that displays: “main -> backup : main”, which means your latest local commit on the local main branch is going to be pushed to the main branch on the remote backup. If you see “main -> origin : main”, just click where it says origin and select backup. Hit the “Push” button.
  7. If you want to see your backed up work on Github, navigate to the following URL but replace USERNAME with your GitHub username:

5. Submit to Gradescope for Grading

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.

Mac Users

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.

Windows Users

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!