CS 149: Introduction to Programming
James Madison University, Spring 2018 Semester

Lab10: Web-CAT submission system

Background

In CS 149, you submit your programming assignments via Web-CAT. This system is also the means by which you receive feedback and grades for your programs.

Collaboration: You are encouraged to work with another student to complete this lab. Each of you should submit your own copy of the code. It's okay if your files are similar or identical, as long as both of your names are present at the top.

Objectives

Key Terms

zip file
compressed file that contains one or more files
code coverage
percentage of code that was tested by JUnit tests
problem coverage
percentage of instructor's test cases that passed

Part 1: Understand the Problem

Write a program to prepare the monthly charge account statement for a customer of CS Card International, a credit card company. The program should take as input the previous balance on the account and the total amount of additional charges during the month. It should then compute the interest for the month, the total new balance (i.e., the previous balance plus additional charges plus interest), and the minimum payment due.

Make sure you understand the calculations before trying to program. Write the algorithm in pseudocode on paper, and test your algorithm with some examples to see how it works.

Part 2: Program the Solution

Much of the solution including output formatting has already been done for you. Use the variables provided and keep all output statements exactly as they are.
  1. Download a copy of CSCard.java and CSCardTest.java as a starting point. Fill in the Javadoc comment for CSCard.java, but don't worry about writing other comments for this lab.

  2. Get the provided code to compile. Write stubs for the calculateInterest and calculateMinPayment methods, returning bogus values for interest and minimum payments for now.

  3. Using the variables provided, code the input statements as described in CSCard.java. You must ensure that the program will not crash if the user enters a bad value (i.e., use hasNextDouble).

  4. Code the rest of the main method as if the two calculate methods were finished, and then test your program. You should see that the code properly reads in a value for the balance and additional charges and outputs the values in the correct format. (The numbers should be wrong until you finish your coding.)

  5. For each calculation (interest and minimum payment), you should code the corresponding method. Run the provided JUnit test cases to make sure your implementation is correct.

  6. When you are sure that your code is working properly, run the main method using a variety of inputs (like you used in your examples on paper). Make sure the output still looks okay.

Part 3: Web-CAT Submission

You will NOT upload your files to Canvas today. We will grade them automatically using Web-CAT instead.

  1. Open a Terminal window and navigate to the directory for your Java files.

  2. Create a new zip archive containing the two Java files:  zip Lab10.zip CSCard.java CSCardTest.java

  3. Log into Web-CAT (webcat.cs.jmu.edu) using your JMU username and password.

  4. Click the "Home" link (if not already on that page) and then click the "Submit" button next to Lab10.

  5. Browse to the zip file that you just created, then click "Upload Submission."

  6. Double check that the correct files were uploaded and click "Confirm."

Web-CAT will score your submission based on three criteria, which we will discuss in more detail in the lab:

Correct Program Incorrect Program (example)