ITP100 Software Design Capstone ATM Interface Project
ITP100 Software Design Capstone ATM Interface Project
Here is my pseudo code outline for the capstone project:
Things I had to look up:
For this project there were a few items I was unfamiliar with and had to look up how to do. This list may not be all inclusive:
First was this bit of code I used in my PIN verification method, the ("\\d+") -
if (!enteredPin.matches("\\d+"))
{
System.out.println("Invalid input. Numbers only please.");
I needed to find a way to ensure that user input for the pin number was a digit.
Next was to convert it to an integer (so I could compare it to the variable I set for the actual pin) -
int convertEnteredPin = Integer.parseInt(enteredPin);
Some fun bits of creativity that I enjoyed:
I got creative in order to verify the data integrity entered by users for withdrawal transactions and reject bad data.
double customerSavingsWithdrawalAmmount = scanner.nextDouble();
if (customerSavingsWithdrawalAmmount > savingsAccountBalance
|| customerSavingsWithdrawalAmmount <= 0
|| (customerSavingsWithdrawalAmmount != 20
&& customerSavingsWithdrawalAmmount != 40
&& customerSavingsWithdrawalAmmount != 80))
{
System.out.println("Sorry, insufficient balance or you did not enter 20, 40, or 80");
System.out.println("Please try a different transaction.");
count2++;
return chooseAccountType();
}
It's basically two types of comparisons; the first verifies account balance is less than withdrawal amount and whether it is $0 or less, and kicks the user back. Next it looks to see whether a transaction request is not 20, 40, or 80 and kicks the user back to the beginning of the method if it's not. It took me a while of trial and error to get the logic to work for these AND and OR statements.
Finished today: 4/29/2024.
It was a lot harder than I anticipated. I had to seek help on the internet for a few things (as far as I know there was no provision set against using outside sources; other than having A.I. write your code for you or plagiarizing someone else's code. For example: our books for the course are online and accessed via the internet; and there's certainly no provision against using our course material for the project; thus accessing the internet for help is acceptable.) Most of the code I had an idea of what to do, but I did need to check the book or the internet to verify syntax o a couple occasions. Some of the things I had to look up were something like this: "if (receiptChoice.equalsIgnoreCase("yes"))". Which was basically error handling for case input from the user.
I did almost everything with nested 'if/else' clauses. I used two 'while' loops to count the transactions and the input attempts for the PIN number and exit the program.
Some of the things I did was work on parts of the code in a modularized fashion. Like the receipt function:
// Prompt for receipt
System.out.print("Would you like a receipt? (yes/no): ");
String receiptChoice = scanner.nextLine();
// Print receipt if requested
if (receiptChoice.equalsIgnoreCase("yes"))
{
System.out.println("\n*** RECEIPT ***");
System.out.println("Transaction Type: Withdrawal from Savings");
System.out.println("Amount: $" + customerSavingsWithdrawalAmmount);
System.out.println("Date and Time: " + date);
System.out.println("Current Savings Account Balance: $" + savingsAccountBalance);
System.out.println("****************\n");
}
else if (receiptChoice.equalsIgnoreCase("no"))
{
System.out.println("No receipt requested.");
}
else
{
System.out.println("Invalid choice. No receipt will be provided.");
}
Once I got what I wanted, I modified for checking and inserted it into the code.
I used 3 tools for my project. My primary IDE was VS Code. I also edited and saved whole code and snippets in Notepad++. I used Jet Brains WebStorm to a limited extent. I'm not overly familiar with it yet, but I do like it's extended functionality.
One of the things I started doing somewhat early on was versioning. I would get a part of my code working and save it. Then I would 'save as' to make a new version. I started doing this after I had a nice sized chunk of code I had working, stop working after adding a significant amount of new code to it and couldn't undo my changes to a successfully running code.
Some of the things I got wrong in the beginning were trying to create a method for everything, like my goodbye message. It was better to just use a print statement wherever it was needed. I don't recall why I thought it was better to have it as it's own method in the beginning, I ended up changing before the midpoint though.


Comments
Post a Comment