Pages

PA3-APCSA-17-18

Programming Assignment 3

AP Computer Science A, 2017-2018

Instructions

  1. Read these instructions completely before beginning this assignment.
  2. Create a Java program as described below.
    • Use Windows Notepad to enter the source code that you submit for grading.
    • Save your source code using Notepad’s default (ANSI) encoding option.
    • Do not look at anyone else’s source code!
    • Write your own code!
    • Cite your sources and any collaboration directly in your source code file using Java comments. (Collaboration that does not involve source code that you submit for grading is okay as long as you cite it.)
    • If you are unsure about what you are supposed to do, ask Mr. Spurgeon for help.
  3. Your Java program should satisfy the following requirements:
    1. Your program should have a public class named Tripmeter with a main method.
    2. When your program is executed without command-line arguments, it should print:
      Movement: none.
      Distance: 0.
      
    3. When your program is executed with the command-line arguments
      "4.5" "-1.3"
      it should print
      Movement: forward 4.5, reverse 5.8.
      Distance: 10.3.
      
    4. When your program is executed with the command-line arguments
      "4.5" "-1.3" "-1.3" "-1.3" "0" "X" "2"
      it should print
      Movement: forward 4.5, reverse 5.8, parked, parked, forward 1.3, CRASH!
      Distance: 11.600000000000001.
      
    5. Your program should produce similar output for other combinations of command-line arguments.
    6. Your program should include complete Javadoc comments for your public class and its main method.
  4. You may use the following source code to get started. (Remember to cite your sources, including any collaboration.)
    /**
     */
    public class Tripmeter {
      /**
       * @param args
       */
      public static void main(String[] args) {
        try {
        }
        catch (Exception e) {
          System.out.println("CRASH!");
        }
      }
    }
    
  5. Make sure that the program you submit for grading compiles and executes as you expect it to before submitting your work.
  6. Appended the following comment to the bottom of the program that you submit for grading. Work that is submitted without this comment will be ignored completely; it will be as if you did not do the assignment.
    /*****************************************************
     * I understand that this is a graded programming
     * assignment and that I have been instructed to
     * do my own work and cite all forms of collaboration.
     * I understand that this means I should not look
     * at anyone else's source code and that I should
     * not share my source code with anyone.
     *
     * The Java program above is my own work. Unless I
     * have confessed in writing in this document,
     * I attest that I did not look at anyone else's
     * source code, I did not share my code with anyone,
     * and I have cited my sources, including all forms
     * of collaboration, in writing in this document.
     *
     * I understand that if I have claimed anyone else's
     * work as my own or if I shared my code with anyone,
     * then I will be penalized if caught, and I
     * understand what the penalties for cheating are.
     *
     * I understand that I must print a copy of this
     * document, sign it, and submit the signed document
     * before my work will be considered for grading.
     ****************************************************/
    
  7. When you are convinced that your program is ready for grading,
    • Attach the file containing your source code to a new email message.
    • Use the following text as the subject of the email message: Programming Assignment 3.
    • Address the email message to: jspurgeon@vcstudent.org.
    • Send the message.
    • Print a copy of the source code file you submitted.
    • Print you name in the upper right hand corner of each page as you have been doing in class.
    • Sign your name below the final comment on the last page of your printed program.
    • If your source code spans multiple printed pages, staple the pages together in order.
    • Put the signed hard-copy in your personal folder in the filing cabinet in room 209.
  8. If you decide to resubmit work for this assignment prior to turning in a signed hard-copy of your work, only the most recently submitted work will be graded; however, once a signed hard-copy has been received, no additional submissions will be accepted.
  9. The assignment is due by 11:59 PM (PST) Saturday, 14 October 2017. The date of the email message you send to Mr. Spurgeon will determine whether your work was submitted on time or not. Don't wait until the last minute to turn in your work. One second late will be treated the same as 1 day, 23 hours and 59 minutes late.