Design, Test Cases, Source Code due: Friday, Oct 24th by 11:59PM
Syntax checking- if it does not run without errors or warnings, it will not be graded
Program Correctness |
60 | |
Gets data from user | ||
Functions are defined properly and of the correct type | ||
sumOfDoubleEvenPlace function correct | ||
getDigit function correct | ||
sumOfOddPlace function correct | ||
getDigit function correct | ||
prefixMatched function correct | ||
getSize function correct | ||
getPrefix function correct | ||
Loops used correctly | ||
Displays results correctly, both values, text and formatting (line breaks, etc.) | ||
Testing | 15 | |
Test cases /15 | ||
Program Design | 15 | |
Individual design /15 | ||
Design and source code are NOT the same thing (10 point penalty!) | ||
Style and documentation |
10 | |
Prolog Comment with Name, Section, Email, Date, Purpose | ||
Meaningful Variable Names | ||
Documentation of Code | ||
Source code Indentation/ formatting/ whitespace |
||
Total | 100 | |
Late Penalty |
I have the authority to deduct points for other items which do not follow the program specifications, as given in the assignment page, or the documentation or other standards stated on the class web page.
Educational Goals: The educational goals of this program are that the student should use the concepts of
Problem Description:
Credit card numbers follow certain patterns. A credit card number must have between 13 and 16 digits. It must start with:
4 for Visa cards
5 for Master cards
37 for American Express cards
6 for Discover cards
In 1954, Hans Luhn of IBM proposed an algorithm for validating credit card numbers. The algorithm is useful to determine if a card number is entered correctly or if a credit card is scanned correctly by a scanner. Almost all credit card numbers are generated following this validity check, commonly known as the Luhn check or the Mod 10 check, which can be described as follows (for illustration, consider the card number 4388576018402626):
Sample interaction with the program:
Example run 1: Enter a credit card number as a long integer: 4246345689049834 4246345689049834 is invalid Example run 2: Enter a credit card number as a long integer: 4388576018410707 4388576018410707 is valid
Notes:
public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a credit card number as a long integer: "); long number = input.nextLong(); if (isValid(number)) System.out.println(number + " is valid"); else System.out.println(number + " is invalid"); }
Test Cases
First, read the assignment carefully. Look for how the program is supposed to behave. You do not know what the code looks like - that is fine. The assignment gives some examples of normal runs. There are other test cases needed. Create a test case table similar to that of program 1. The test cases are due at the same time your design and code are due.
Design
Decide on what steps you will need to perform to solve this problem.
Make a numbered list and put it in Java form.
Save this Java file as "design3.java". Each function should have steps numbered from 1
// main function // step 1: prompt for credit card number // ... enter your steps here // compute things // output things // isValid function // step 1: // step 2: // fill in the rest of the design // design the other functions ...and individually fill in the missing steps in the design. This is due by Friday, October 24th, 11:59PM same time the code and test cases.
Implement the design
Write a Java program to implement your design.
Make a copy of the Java file you have that has
the design in it and write your Java code between
the commented lines of the design.
Make sure you eliminate any syntax and semantics errors.
Here is where test cases come in handy!
Submit your individual source code with the link here.
Choose the menu choices of "Code" and "Program 1".
This is due by Friday, October 24th, 11:59PM.
There are several specifications about how your program should be written.
Please read the documentation standard on the class web page. As you can see from looking at the grading criteria, we will be looking to see how you meet these standards. Note particularly that we require a prolog!
Remember that the program must run with NO errors or warnings. If it does not, it will not be graded!