Exercises

Academic Integrity

  • Remember the Academic Integrity Policy when completing assignments.

    • You can work with classmates but not to the point of sharing code.

      • Do not ask to see a classmates code or show a classmate your code.

    • Do not search for exercise solutions or copy and paste code you find. Everything you need to solve the problems can be found within the course. Think!

    • Do not post solutions in whole or in part.

If you don't understand how to solve a problem, utilize resources from the course web site and seek assistance from a student assistant or the professor.

One Time Instructions

  • Create a free "For Developers" account on HackerRank if you don't already have one.

  • Join the course contest: https://www.hackerrank.com/2006s21

  • You can run against custom input in HackerRank but it is better to code in your IDE.

Weekly Instructions

  • For each Exercise assignment, you only need to do the corresponding problems below: (TBD indicates a problem will be added at least a couple of days before the due date of the assignment)

    • 1 Welcome to Java!, Java Output Variable, Java Output Literal + Variable

    • 2 PV Java Data Types, Java Stdin and Stdout I, Java Stdin and Stdout II

    • 3 Java Strings Introduction, Java Substring, PV String Escape Sequence

    • 4 Cats and a Mouse, PV Value Returning Function cubeIt, PV gets and sets

    • 5 PV String Format Item Average, PV Math class Circles, PV String Format 2

    • 6 Java If-Else, PV Menu Switch, PV Graduation Check

    • 7 Staircase, Utopian Tree, Java Loops I

    • 8 Caesar Cipher, PV Class Car, PV Class Constructor

    • 9 Java Inheritance I, PV Shapes Inheritance, Java Method Overriding

    • 10 Java 1D Array, Java 2D Array, PV Array Operations

    • 11 Java Exception Handling (Try-catch), Exceptions OR PV Exception Input, PV Exception Inheritance

  • It is alright if you can't complete all of the problems. You will earn partial credit for completing some of them. See the grading form in Canvas. Submit at least some exercises each week they are due. You can resubmit the assignment in Canvas after you complete additional problems if necessary (subject to class late penalty noted on syllabus).

Submission Instructions

  • Copy the line below and change the end and paste it into the Canvas assignment.

  • https://www.hackerrank.com/contests/2006s21/compare/yourusername

Exercises Description

In order to learn and practice programming at your own pace and with instant feedback, this course utilizes HackerRank.com.

HackerRank.com is a web site that provides programming challenges in multiple languages. You can write and run code right on the site without worrying about installing and setting up anything on your computer.

HackerRank could even help you get a job.

“Some companies often ask for TopCoder or HackerRank handle in their applications. So, your performance can be used as a criteria for application evaluation.

More importantly, even if your potential employer do not look into your TopCoder or HackerRank or Codechef profiles, experience you get from participating there can be very useful. You can enhance your skills, evaluate yourself.”

Work process and file management suggestions:

Although you can write and run code on the web site, it is better to work on your code in a program that is specially designed for writing, debugging and running code because it will be faster, more stable, provide better feedback of mistakes, and have better tools for code auto-completion and formatting. These programs are called integrated development environments or IDEs. Examples of IDEs for Java include NetBeans, Eclipse, and IntelliJ IDEA. You can find download links and more information on the course web site. I suggest you try to gain experience with a variety of these.

  1. Create a new project in the IDE of your choice. Create a class and main method. Make sure you can run the program.

  2. After reviewing course resources and examples, access a challenge.

  3. Copy and paste the provided code from the main method in the challenge to your main method. Do not copy and paste the class name, namespace, or anything else.

  4. Work on the exercise within the IDE. Do one little thing at a time. Try to run the program often.

  5. When you get the program working in the IDE, copy and paste the code back into the web site and see if it passes. If your program runs in the IDE and you cannot figure out why it doesn’t pass, contact me.

  6. Optionally: Save your solution into your integration project or to cloud storage such as OneDrive or GitHub so you can access your files anywhere and don’t have to worry about a hard drive crash or losing a flash drive.

    1. For Google Drive you can drag your .java file into the Google Drive web site or you can just copy and paste Java code into a regular Google Drive document but it will not keep the formatting and color coding. To keep the formatting, and to allow you to view and edit the files within Google Drive, you can install a Google Drive add on called Drive Notepad.

Additional Practice