CS 112
Summer I 2025

Problem Set 1

due by 11:59 p.m. Eastern time on Tuesday, May 27, 2025

Preliminaries

In your work on this assignment, make sure to abide by the collaboration policies of the course.

If you have questions while working on this assignment, please come to office hours, post them on Piazza, or email your instructor.

Make sure to follow the instructions outlined at the end of Part I and Part II when submitting your assignment.

Part I

69 points total

This part of the assignment consists of a series of short-answer questions. You will be able to check your answers to at least some of these questions by executing the code, but we strongly encourage you to answer them on your own and to convince yourself of the correctness of your answers before you try to test them. These questions are similar to ones that could appear on the midterms and final exam, so it’s important to be able to answer them without the use of a computer.

Creating the necessary file

The problems from Part I will all be completed in a single PDF file. To create it, you should do the following:

  1. Access the template that we have created by clicking on this link and signing into your Google account as needed.

  2. When asked, click on the Make a copy button, which will save a copy of the template file to your Google Drive.

  3. Select File->Rename, and change the name of the file to ps1_partI.

  4. Add your work for the problems from Part I to this file.

  5. Once you have completed all of these problems, choose File->Download->PDF document, and save the PDF file on your machine. The resulting PDF file (ps1_partI.pdf) is the one that you will submit. See the submission guidelines at the end of Part I.

Problem 1: Learning to read (Java code)

13 points total; individual-only

  1. Suppose that a and b are int values. Simplify the following expressions to a boolean expression involving only a single operator:

    1. (!(a < b) && !(a > b))
    2. ( (a < b) == true )
    3. ( (a <= b) == false )
    4. (!(a > b) && !(a < a))
    5. ( (b < b) || !(a <= b))
  2. Which of the following will create an error because of a misuse of types?

    1. int n = 3 + '3';
    2. double x = (3.4 + (int) 2.1) * "3";
    3. String s = "hi" + 5 + 't' + true + "there";
  3. What do each of the following print? (Be sure you understand WHY!)

    1. System.out.println(2 + "bc"); 
    2. System.out.println(2 + 3 + "bc");  
    3. System.out.println((2+3) + "bc"); 
    4. System.out.println("bc" + (2+3)); 
    5. System.out.println("bc" + 2 + 3); 

Problem 2: Java programming basics

18 points total; individual-only

Using folders

You should create a separate folder for each assignment.

If you haven’t already created a folder named cs112 for your work in this course, follow these instructions to do so.

Then create a subfolder called ps1 within your cs112 folder for your work on this assignment, and put all of the files for PS 1 in that folder.

  1. (5 points) The following program has many syntax errors:

    import java.util.*;
    
    public Problem2 {
        /*
         * This static method should take an integer x and return:
         *    - the opposite of x when x is negative
         *    - 10 more than x when x is non-negative and even
         *    - the unchanged value of x when x is non-negative and odd
         */
        public static adjust(x)
            if x < 0:
                x * -1;
            elif x % 2 = 0:
                x =+ 10
    
            return x;
        }
    
        public main(String[] args):
            Scanner console = Scanner()
    
            System.out("Enter an integer x: ")
            x = console.nextInt();
    
            System.out('adjust(x) = ', adjust(x));
    }
    

    Determine and fix all of the problems with this program so that it will compile and do the following when run:

    • Ask the user to enter an integer and store the user’s input in the variable x.

    • Call the method adjust with x as its input, and print the value returned by that method. adjust should have the functionality specified in the comment that precedes it.

    Here’s what a run of the program should look like if the user enters -4:

    Enter an integer x: -4
    adjust(x) = 4
    

    And here’s what it should look like if the user enters 6:

    Enter an integer x: 6
    adjust(x) = 16
    

    You should first try and debug the above code paper and pencil. Once you think you have identified all the errors, verify by Debugging in VS Code.
    We encourage you to use VS Code to help you to debug this program. Here are the steps:

    1. If you haven’t already done so, create a folder named ps1 for your work on this assignment.

    2. Download the following file: Problem2.java

      Make sure to put the file in your ps1 folder. If your browser doesn’t allow you to specify where the file should be saved, try right-clicking on the link above and choosing Save as... or Save link as..., which should produce a dialog box that allows you to choose the correct folder for the file.

    3. In VS Code, select the File->Open Folder or File->Open menu option, and use the resulting dialog box to find and open the folder that you created for this assignment. (Note: You must open the folder; it is not sufficient to simply open the file.)

      The name of the folder should appear in the Explorer pane on the left-hand side of the VS Code window, along with the name of the Problem2.java file that you downloaded above.

    4. Click on the name Problem2.java, which will open an editor window for that file.

    5. Make whatever edits are needed to allow you to compile and run the program. You can try to run the program by using the F5 key, or by right-clicking the name of the program in the Explorer pane and choosing Run or Run Java.

      Note: VS Code may show you a message that looks like this:

      Resource leak: 'console' is never closed
      

      You can ignore this message. It is warning, not an error, and it will not keep the program from compiling and running.

    Once you are confident that you have fixed all of the problems in the code, put the revised program in your ps1_partI file as your answer to this question. (See the guidelines at the start of Part I for how to create this file.)

  2. (5 points) Assume that the following variable declarations have already been executed:

    int x = 23;
    double y = 4;
    int z = 4;
    double n = 14.0;
    

    Given the statements above, determine the value of each of the following expressions. Make sure that your answers clearly indicate the type of each value. In particular, floating-point values should have a decimal and strings should be surrounded by double quotes.

    1.      x / y
    2.      x / z
    3.      x + y
    4.      "x" + "y"
    5.      x % 6
    6.      y == z
    7.      (int)(n / z * z)
    8.      (int)n / z * z
    9.      11 + 2 + "CS"
    10.      "CS" + 11 + 2
  3. (8 points) Assume that the following variable declarations have already been executed:

    int f = 15;
    int g = 2;
    double h = 2.0;
    double i = 2;
    double j = 10.0;
    

    Given the statements above, determine the value of each of the following expressions. Make sure that your answers clearly indicate the type of each value. In particular, floating-point values should have a decimal and strings should be surrounded by double quotes.

    1.      f + "g"
    2.      f / g
    3.      f / h
    4.      f / i
    5.      (int)j / f * f
    6.      (int)(j / f) * f
    7.      "1" + 1 + 2
    8.      1 + 1 + "2"

Problem 3: Conditional execution

9 points total; individual-only

Consider the following code fragment:

Scanner scan = new Scanner(System.in);
System.out.print("Enter three numbers: ");
int a = scan.nextInt();
int b = scan.nextInt();
int c = scan.nextInt();

if (a <= c) {
    if (c > b && a < 5) {
        System.out.println("Terriers");
    } else {
        System.out.println("Eagles");
    }
    System.out.println("Crimson");
} else if (b < a) {
    if (b == c) {
        System.out.println("Huskies");
    } else if (b > c) {
        System.out.println("Engineers");
    } else {
        System.out.println("Bears");
    }
    if (a < c) {
        System.out.println("Lions");
    }
} else {
    System.out.println("Big Green");
    if (a == b || b > 7) {
        System.out.println("Big Red");
    }
    if (!(b > c)) {
        System.out.println("Quakers");
    }
    if (a != c) {
        System.out.println("Bulldogs");
    }
}
System.out.println("Let's go!");
  1. (6 points) In section 3-2 of ps1_partI (see above), state the output that would result from each of the following sets of inputs. (In each case, the first number will be assigned to the variable a, the second number will be assigned to b, and the third number will be assigned to c.)

    1.     1 2 3
    2.     4 1 4
    3.     3 1 2
    4.     5 8 3
    5.     5 4 4
    6.     3 5 2
  2. (3 points) At least one of the println statements in the above code fragment will not be executed for any set of inputs. Identify the statement(s) and explain why it/they will never be executed.

Problem 4: Static methods

10 points total; individual-only

  1. (5 points) Consider the following Java program, which includes two static methods:

    public class TracingMethodCalls {
        public static int compute(int x, int y) {
            x += 3;
            y = 2*y - x;
            System.out.println(x + " " + y);
            return x;
        }
    
        public static void main(String[] args) {
            int x = 1;
            int y = 3;
            System.out.println(x + " " + y);
            x = compute(x, y);
            System.out.println(x + " " + y);
            compute(y, y);
            System.out.println(x + " " + y);
            y = 3 + 4 * compute(y, x);
            System.out.println(x + " " + y);
        }
    }
    

    In section 4-1 of ps1_partI (see above), we have given you tables that you should complete to illustrate the execution of the program.

    We have started the first and third tables for you. You should:

    • complete the first and second tables so that they illustrate how the values of the variables change over time
    • complete the last table so that it shows the output of the program (i.e., the values that are printed).

    You may not need all of the rows provided in the tables.

  2. (5 points) Fill in the blanks below to create a static method that takes as parameters two integers representing a person’s weight w (specified to the nearest pound) and height h (specified to the nearest inch), and that computes and returns the person’s body mass index (BMI) as a real number (i.e., one that could have a fractional part).

    public _____________ bmi(______________________) {
        double result = ___________________;
        __________________;
    }
    

    When computing the BMI, you should use the following formula:

          720 * w
    BMI = -------
           h * h
    

    For example:

    • the method call bmi(100, 60) should return 20.0
    • the method call bmi(162, 72) should return 22.5

    Note that the body of the method should be exactly two lines: one line that assigns the appropriate expression for the BMI to the variable result, and a second line that returns the value of result.

    Important: In Java, the / operator is used for both integer division and floating-point division. In order to get floating-point division — which preserves the digits after the decimal — you need to make sure that at least one of the operands is a floating-point number. If both of the operators are integers, you will get integer division.

Problem 5: Loops

10 points total; individual-only

  1. (3 points) In ps1_partI, we have included the following partial code fragment:

    for (____________; ____________; ____________) { 
        System.out.println("Twenty two!");
    }
    

    Fill in the blanks to create a loop that repeats the message “Twenty two!” 2022 times. Use the approach for obtaining N repetitions that we discussed in lecture.

  2. (3 points) Consider the following method:

    public static void countDown(int n) {
        for (int count = n; count >= 1; count--) {
            System.out.println(count);
        }
    }
    

    When the input n is a positive integer, this method “counts down” from n, printing the integers from n down to 1. For example, countDown(5) would print

    5
    4
    3
    2
    1
    

    If n is less than or equal to 0, the method does not print anything.

    We have included the original method in ps1_partI. Rewrite it so that it uses a while loop instead of a for loop.

  3. (4 points) Consider the following code fragment:

    for (int i = 1; i <= 4; i++) {
        System.out.println("** " + i + " **");
        for (int j = 3; j >= 0; j++) {
            System.out.println(i + " " + j);
        }
    }
    

    Modify this fragment to make it produce the following output:

    ** 1 **
    1 3
    1 2
    1 1
    ** 2 **
    2 3
    2 2
    ** 3 **
    3 3
    

    We have included the original code fragment in ps1_partI. Make whatever changes are needed to obtain the correct output. The corrected version should still consist of six lines, with one three-line for loop nested in another for loop.

Problem 6: Variable scope

9 points total; individual-only

This topic will be covered in lecture on Tuesday, June 6/28

Consider the following program, which includes a number of incomplete println statements:

public class ScopePuzzle {
    public static void myMethod(int e) {
        int i;
        for (i = 0; i < 10; i++) {
            System.out.println(________);        // first println

            int a = 5;
            for (int j = 0; j < 3; j++) {
                int b = 0;
                System.out.println(________);    // second println
            }
            System.out.println(________);        // third println
        }

        int y = 3;
        System.out.println(________);            // fourth println
    }

    public static void main(String[] args) {
        int c = 0;

        System.out.println(________);            // fifth println

        int d = 1;
        myMethod(c);

        System.out.println(________);            // sixth println
    }
}

The program includes a number of int variables: a, b, c, d, e, i, j, and y. Given the rules that we have learned about variable scope:

  1. Which of these variables could be printed by the first println statement?
  2. Which of them could be printed by the second println statement?
  3. Which of them could be printed by the third println statement?
  4. Which of them could be printed by the fourth println statement?
  5. Which of them could be printed by the fifth println statement?
  6. Which of them could be printed by the sixth println statement?

Note that we are only focusing on the variables of type int, so you can ignore the args parameter of the main method.

Submitting your work for Part I

Note: There are separate instructions at the end of Part II that you should use when submitting your work for that part of the assignment.

Submit your ps1_partI.pdf file using these steps:

  1. If you still need to create a PDF file, open your ps1_partI file on Google Drive, choose File->Download->PDF document, and save the PDF file on your machine.

  2. Login to Gradescope by clicking the link in the left-hand navigation bar. (If you don’t have a Gradescope account, you can create one now, but you must use your BU email address and ID number.)

  3. Once you are logged in, click on the box for CS 112. (If you don’t see that box, you should email your instructor so that we can add you to the course’s Gradescope site.)

  4. Click on the name of the assignment (PS 1: Part I) in the list of assignments on Gradescope. You should see a pop-up window labeled Submit Assignment. (If you don’t see it, click the Submit or Resubmit button at the bottom of the page.)

  5. Choose the Submit PDF option, and then click the Select PDF button and find the PDF file that you created. Then click the Upload PDF button.

  6. You should see a question outline along with thumbnails of the pages from your uploaded PDF. For each question in the outline:

    • Click the title of the question.
    • Click the page(s) on which your work for that question can be found.

    As you do so, click on the magnifying glass icon for each page and doublecheck that the pages that you see contain the work that you want us to grade.

  7. Once you have assigned pages to all of the questions in the question outline, click the Submit button in the lower-right corner of the window. You should see a box saying that your submission was successful.

Important

  • It is your responsibility to ensure that the correct version of every file is on Gradescope before the final deadline. We will not accept any file after the submission window for a given assignment has closed, so please check your submissions carefully using the steps outlined above.

  • If you are unable to access Gradescope and there is enough time to do so, wait an hour or two and then try again. If you are unable to submit and it is close to the deadline, email your homework before the deadline to your instructor.


Part II

40 points total

Important guidelines

The following guidelines apply to the programming problems (i.e., problems in which you submit a .java file) in this and all subsequent assignments.

  • You should not use any built-in Java classes or methods that we have not covered in the lecture notes, unless we explicitly instruct you to do so.

  • Use good programming style. Use appropriate indentation, select descriptive variable names, insert blank lines between logical parts of your program, and add comments as necessary to explain what your code does. See the coding conventions for more detail.

  • At a minimum we expect that your submitted code will compile and run. If your code does not compile during our tests, you will not receive any credit for that specific problem. If there are lines in your program that prevent it from compiling, remove them or turn them into comments by putting two slashes (//) at the start of the each of the problematic lines. If you are unsure about how to get your program to compile, feel free to ask us for help.

Problem 6: Computing the cost of a car trip

10 points total; pair-optional

This is the first of two problems of this assignment that you may complete with a partner. See the rules for working with a partner on pair-optional problems for details about how this type of collaboration must be structured.

Important

Some of the points for Part II will be based on your use of good programming style. Use appropriate indentation, select descriptive variable names, insert blank lines between logical parts of your program, and add comments as necessary to explain what your code does. See the coding standards for more detail.

This problem asks you to complete a simple program that allows a user to compute the cost of a trip by car. The cost is based on three inputs: the price of gas, the car’s MPG (miles per gallon) rating, and the distance of the trip.

Getting started

  1. If you haven’t already done so, create a folder named ps1 for your work on this assignment. You can find instructions for doing so here.

  2. Download the following file: TripComp.java

    Make sure to put the file in your ps1 folder. If your browser doesn’t allow you to specify where the file should be saved, try right-clicking on the link above and choosing Save as... or Save link as..., which should produce a dialog box that allows you to choose the correct folder for the file.

  3. In VS Code, select the File->Open Folder or File->Open menu option, and use the resulting dialog box to find and open the folder that you created in step 1. (Note: You must open the folder; it is not sufficient to simply open the file.)

    The name of the folder should appear in the Explorer pane on the left-hand side of the VS Code window, along with the name of the TripComp.java file that you downloaded in step 2.

  4. Click on the name TripComp.java, which will open an editor window for that file. You will see that we’ve given you the beginnings of the program.

Completing the program

  1. Start by reading over the starter code that we’ve given you. Make sure that you understand it.

  2. Complete the assignment statements in the main method for the variables gasPrice, mpgRating, and distance. At the moment, each of these assignment statements assigns the number 0. For example, here is the first of the three assignments:

    int gasPrice = 0;
    

    You should replace the 0 in each of the three assignments with a call to a Scanner method that reads an integer entered by the user from the keyboard.

    Important: You must use the Scanner object created at the start of the main method, and you may not create an additional Scanner object.

    You may assume that all of the values entered by the user are valid values, and thus you do not need to perform any checking for problematic values.

  3. Complete the main method so that it uses the values of the variables gasPrice, mpgRating, and distance to compute the cost of the trip in dollars using the following formula:

           gasPrice   distance
    cost = -------- * ---------
              100     mpgRating
    

    For example, if gas costs 300 cents per gallon, the car’s MPG rating is 25 miles per gallon, and the trip is 200 miles, the program should perform the computation

    300   200
    --- * --- = 24
    100   25
    

    Notes:

    • The formula that we have given you uses standard mathematical notation. You will need to use the appropriate Java operators and appropriate numeric literals in your code.

    • You may find it helpful to compute the cost in stages by first computing some of the components of the formula – storing their values in one or more variables that you declare – and then combining those components to compute the final result.

    • In the example above, the cost happens to be an integer, but that won’t always be the case, and you should make your computation as precise as possible. This means that you will need to be careful with the type that you select for your cost variable (and any other variables that you may use for intermediate results) and in the expressions that you construct for your computations.

  4. Display the result in the appropriate format.

    • If the cost is an integer (i.e., a whole number of dollars, with no additional cents), then the cost should be printed without a decimal. For example, here is a sample run in which the user enters the values mentioned in the above example:

      gas price in cents: 300
      MPG rating of the car: 25
      distance of the trip: 200
      The cost of the trip is $24.
      

      Note: The first three lines above are from the portion of the program that uses Scanner methods to get the necessary values from the user. You should not echo/re-print the user’s inputs. The only new print statement that you should add is the one for the cost of the trip.

    • If the cost is not a whole number of dollars, then the cost should be printed in the form $d.cc, where d is the number of dollars, and cc is the number of cents rounded to two places after the decimal. For example, here is another sample run in which the cost is not a whole number:

      gas price in cents: 300
      MPG rating of the car: 20
      distance in miles: 210
      The cost of the trip is $31.50.
      

      To ensure that you always get two places after the decimal, you should make a call to the method called formattedCost that we have provided. Read the comments that precede that method to see what it does.

    Notes:

    • There is more than one way to test if the computed cost is a whole number. You may want to consider using a type cast in some way.

    • Make sure that the format of your results matches what we have shown above. In particular, you should have a dollar sign ($) immediately before the price and a period (.) immediately after it.

  5. Test your program on a variety of inputs to make sure that you don’t have any logic errors in your code.

    Remember that you can run the program by using the F5 key, or by right-clicking the name of the program in the Explorer pane and choosing Run or Run Java.

    Notes:

    • VS Code may show you a message that looks like this:

      Resource leak: 'scan' is never closed
      

      You can ignore this message. It is warning, not an error, and it will not keep the program from compiling and running.

    • When your run the program, you may need to click on the Terminal area of VS Code in order to input the three numbers.

Problem 7: Computing the length of a ladder

10 points; individual-only

Your friend needs to use a ladder to reach a certain point on the outside of their house. To avoid adjusting the ladder once it’s in the air, they ask you to create a program that allows them to precompute the required length of the ladder.

Getting started

  1. As needed, open your ps1 folder using the File->Open Folder or File->Open menu option in VS Code.

  2. Select File->New File, which will open up an empty editor window.

  3. Select File->Save, and give the new file the name Ladder.java.

Writing the program

  1. Add comments at the top of the new file that include:

    • a brief desciption of what the program is supposed to do.
    • your name and email address

    See the comments that we provided in the starter code for previous problem for an example of what they should look like.

  2. Below the comments – and before any class header – add an import statement for the java.util package, as we did in the starter code for the previous problem. Including this import statement will allow you to create a Scanner object in your program.

  3. Create a class named Ladder that will serve as a container for your program.

  4. Inside the Ladder class, add a main method with the usual header.

  5. Start the main method by creating a Scanner object for getting user inputs from the keyboard and assigning it to an appropriate variable.

  6. Next, add statements to read the following values from the user and store them in appropriate variables:

    • an integer representing the height of the point the ladder needs to reach (specified to the nearest foot)

    • an integer representing the angle in degrees at which the ladder will be positioned (specified to the nearest degree)

    Use a print statement with an appropriate prompt for each input, and use the Scanner that you created at the start of main to get each input from the user.

    Important: You must use the Scanner object created at the start of the main method, and you may not create an additional Scanner object.

  7. Convert the value entered for the angle in degrees to an equivalent real number in radians:

              angle * Math.PI
    radians = ---------------
                   180
    

    where angle is the angle in degrees that was entered by the user and Math.PI is a built-in constant that Java provides for the value of π. Make the computation as precise as possible.

  8. Compute the required length of the ladder as a real number as follows:

                  height
    length = ----------------- 
             Math.sin(radians)
    

    where height is the height in feet entered by the user and Math.sin is a built-in method that Java provides for computing the sine of an angle. Make the computation as precise as possible.

  9. Report the length of the ladder in three forms:

    • in feet as a real number
    • in yards as a real number (yards = feet / 3)
    • as an integral number of yards, with the remaining length expressed in feet as a real number

    For example, if the height is 20 feet and the angle is 60 degrees, the output should look like this:

    The required length is: 
    23.094010767585033 feet
    7.698003589195011 yards
    7 yards and 2.094010767585033 feet
    
  10. Test your program on a variety of inputs to make sure that you don’t have any logic errors in your code.

Problem 8: A simple interactive program

20 points total; pair-optional

This is the second of two problems of this assignment that you may complete with a partner. See the rules for working with a partner on pair-optional problems for details about how this type of collaboration must be structured.

This problem provides additional practice with writing static methods, but it also gives you a chance to write a simple program with repeated user interactions and conditional logic. In particular, the program will allow the user to perform a variety of operations on a set of three integers.

Getting started:

Begin by accessing the following file: SimpleStats.java

It provides a skeleton for your program.

We have provided you with the beginnings of the main() method, including the core of the user-interaction loop. You must add the required conditional logic within the body of the loop so that your program executes following the stated program requirements.

Your program should begin with a welcome message and then display the following menu of choices:

(0) Enter new numbers
(1) Find the largest
(2) Compute the sum
(3) Compute the range (largest - smallest)
(4) Compute the average
(5) Print the numbers in ascending order
(6) Quit

Enter your choice:

Your program should not allow you to choose options 1-5 unless option 0 is chosen to input the three numbers. If an option to perform an operation on the numbers is chosen before the numbers are entered, an error message should be displayed and the program should continue. Example:

Cannot compute, numbers have not been entered.

(0) Enter new numbers
(1) Find the largest
(2) Compute the sum
(3) Compute the range (largest - smallest)
(4) Compute the average
(5) Print the numbers in ascending order
(6) Quit

Enter your choice:

Note: The words “Cannot compute” must appear in your error message.

Once option 0 is chosen, then you should be allowed to choose all other valid options. If a number is entered that is not a valid menu choice, the user should be told that it is an invalid option. Example:

Invalid choice. Please try again.

Note: The words “Invalid choice” must appear in your error message.

Your tasks Begin by understanding the problem, and the starter code given. First complete option 0. Once you verify that your program correctly inputs the three numbers, add the remaining supporting methods to complete options 1-5 one method at a time. Make sure to follow the logic as shown in the sample run. In particular, pay attention to the output statements.

Important notes:

A sample run can be found here. Please match the formatting of the results in that file as closely as possible or your submission may not pass the autograder tests.`

Submitting your work for Part II

Note: There are separate instructions at the end of Part I that you should use when submitting your work for that part of the assignment.

Submission checklist for Part II

  • You have read the Java coding standards and followed all guidelines regarding format, layout, spaces, blank lines, and comments.

  • You have verified that your code satisfies all of the tests that we have provided, and you have conducted whatever other tests are needed to ensure that your code works correctly.

Pair-optional problem

If you chose to work on Problem 5 with a partner, both you and your partner should submit your own copy of your joint work, along with your individual work on the other problem.

You should submit only the following files:

Make sure that you do not try to submit a .class file or a file with a ~ character at the end of its name.

Here are the steps:

  1. Login to Gradescope as needed by clicking the link in the left-hand navigation bar, and then click on the box for CS 112.

  2. Click on the name of the assignment (PS 1: Part II) in the list of assignments. You should see a pop-up window with a box labeled DRAG & DROP. (If you don’t see it, click the Submit or Resubmit button at the bottom of the page.)

  3. Add your files to the box labeled DRAG & DROP. You can either drag and drop the files from their folder into the box, or you can click on the box itself and browse for the files.

  4. Click the Upload button.

  5. You should see a box saying that your submission was successful. Click the (x) button to close that box.

  6. The Autograder will perform some tests on your files. Once it is done, check the results to ensure that the tests were passed. If one or more of the tests did not pass, the name of that test will be in red, and there should be a message describing the failure. Based on those messages, make any necessary changes. Feel free to ask a staff member for help.

    Note: You will not see a complete Autograder score when you submit. That is because additional tests for at least some of the problems will be run later, after the final deadline for the submission has passed. For such problems, it is important to realize that passing all of the initial tests does not necessarily mean that you will ultimately get full credit on the problem. You should always run your own tests to convince yourself that the logic of your solutions is correct.

  7. If needed, use the Resubmit button at the bottom of the page to resubmit your work. Important: Every time that you make a submission, you should submit all of the files for that Gradescope assignment, even if some of them have not changed since your last submission.

  8. Near the top of the page, click on the box labeled Code. Then click on the name of each file to view its contents. Check to make sure that the files contain the code that you want us to grade.

Important

  • It is your responsibility to ensure that the correct version of every file is on Gradescope before the final deadline. We will not accept any file after the submission window for a given assignment has closed, so please check your submissions carefully using the steps outlined above.

  • If you are unable to access Gradescope and there is enough time to do so, wait an hour or two and then try again. If you are unable to submit and it is close to the deadline, email your homework before the deadline to cs112-staff@cs.bu.edu