{"id":26635998,"url":"https://github.com/prathush-kumar/bankaccount-java-abstract-class","last_synced_at":"2026-05-06T07:37:44.032Z","repository":{"id":282008882,"uuid":"947173127","full_name":"Prathush-Kumar/BankAccount-Java-Abstract-Class","owner":"Prathush-Kumar","description":"Range of Object Oriented Programming Projects in the Java Programming Language","archived":false,"fork":false,"pushed_at":"2025-03-12T10:05:18.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T16:15:53.567Z","etag":null,"topics":["git","java","object-oriented-programming"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Prathush-Kumar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-12T09:15:21.000Z","updated_at":"2025-03-12T10:06:33.000Z","dependencies_parsed_at":"2025-03-12T10:28:20.479Z","dependency_job_id":"610ca794-9b27-48ae-8a62-4aaeef0c30f9","html_url":"https://github.com/Prathush-Kumar/BankAccount-Java-Abstract-Class","commit_stats":null,"previous_names":["prathush-kumar/bankaccount-java-abstract-class"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FBankAccount-Java-Abstract-Class","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FBankAccount-Java-Abstract-Class/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FBankAccount-Java-Abstract-Class/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FBankAccount-Java-Abstract-Class/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prathush-Kumar","download_url":"https://codeload.github.com/Prathush-Kumar/BankAccount-Java-Abstract-Class/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245304872,"owners_count":20593626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","java","object-oriented-programming"],"created_at":"2025-03-24T16:15:59.187Z","updated_at":"2026-05-06T07:37:44.027Z","avatar_url":"https://github.com/Prathush-Kumar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BankAccount Java Abstract Class      \n          \n## Required Skills Inventory\nTo complete this task, you should be familiar with the following concepts and skills:       \n- Java programming language\n\n- Object-oriented programming (OOP) concepts\n- Abstract classes and methods\n- Implementing class inheritance\n- Understanding UML Class Diagrams and translating them to Java code\n\n## Problem Description and Given Info\nYou are required to create a public abstract class named `BankAccount` in Java, following the Interface specifications given in the provided UML Class Diagram. The abstract class represents a generic bank account and contains fields and methods as described below.\n\n### BankAccount Class Diagram\n\n![Screenshot 2025-03-12 150259](https://github.com/user-attachments/assets/a3ffd3dd-9b2c-43ad-b480-c5eb50dd2486)\n\n\n### Structure of the Fields\nAs described by the UML Class Diagram, your `BankAccount` class must have the following fields:\n```java\nprotected String accountID = \"0000-0000-0000-0000\";\nprotected double interestRate = 0.0;\nprotected int balance = 0;\n```\n\n### Structure of the Methods\nAs described by the UML Class Diagram, your `BankAccount` class must have the following methods:\n```java\npublic boolean credit(int amount);\npublic abstract boolean debit(int amount);\npublic int getBalance();\npublic String getAccountID();\npublic void setAccountID(String accountID);\npublic double getInterestRate();\npublic void setInterestRate(double interestRate);\npublic abstract void applyInterest();\npublic abstract String accountInfo();\n```\n\n### Behavior of the Methods\n1. The `credit` method should add the `amount` argument to the `balance`.\n\n2. The `debit` method is abstract, so there will be no behavior or method body for it. This will be implemented in the subclasses that extend `BankAccount`.\n3. The `getBalance` method should return the current balance.\n4. The `getAccountID` method should return the accountID.\n5. The `setAccountID` method should store the argument value in the `accountID` field.\n6. The `getInterestRate` method should return the interestRate.\n7. The `setInterestRate` method should store the argument amount in the `interestRate` field.\n8. The `applyInterest` method is abstract, so there will be no behavior or method body for it. This will be implemented in the subclasses that extend `BankAccount`.\n9. The `accountInfo` method is abstract, so there will be no behavior or method body for it. This will be implemented in the subclasses that extend `BankAccount`.\n\n### Additional Information\n- Since this is an abstract class, you will not be able to instantiate any object from it.\n- You are given a `TestAccount` class that extends `BankAccount`. You may use this to help with testing your `BankAccount` class.\n\n- You are also given a `Main` class with a `main` method where you can write code to test your `BankAccount` class.\n- All bank accounts use balance, credit, and debit amounts, and fees stored and passed as a number of pennies (int).\n- All debit amounts will be subtracted from the balance, and all credit amounts will be added to the balance.\n- All bank accounts have a non-negative interest rate (0.02 would be a 2% interest rate).\n- The `credit` method will always return `true`.\n\n## Getting Started\n1. Create a new Java project in your favorite IDE or editor.\n\n2. Define a new Java file called `BankAccount.java`.\n3. Implement the `BankAccount` class according to the provided UML Class Diagram and method behavior descriptions.\n4. Create additional Java files for subclasses (e.g., `SavingsAccount.java`, `CheckingAccount.java`) that extend `BankAccount` if needed.\n5. Implement the abstract methods in the subclasses.\n6. Use the `TestAccount` and `Main` classes to test your `BankAccount` and its subclasses.\n\n## Example Usage\n```java\n// Sample usage of BankAccount and its subclasses\npublic class Main {\n    public static void main(String[] args) {\n        // Example code to create and use bank accounts\n        // (This is just a sample and not a comprehensive test)\n\n        // Creating a savings account\n        BankAccount savingsAccount = new SavingsAccount(\"1234-5678-9012-3456\");\n        savingsAccount.setInterestRate(0.05); // Set a 5% interest rate\n        savingsAccount.credit(1000); // Credit 1000 pennies (i.e., $10)\n        savingsAccount.applyInterest(); // Apply the interest rate\n        System.out.println(\"Savings Account Balance: \" + savingsAccount.getBalance());\n\n        // Creating a checking account\n        BankAccount checkingAccount = new CheckingAccount(\"9876-5432-1098-7654\");\n        checkingAccount.credit(500); // Credit 500 pennies (i.e., $5)\n        checkingAccount.debit(200); // Debit 200 pennies (i.e., $2)\n        System.out.println(\"Checking Account Balance: \" + checkingAccount.getBalance());\n\n        // Print account information\n        System.out.println(\"Savings Account Info: \" + savingsAccount.accountInfo());\n        System.out.println(\"Checking Account Info: \" + checkingAccount.accountInfo());\n    }\n}\n```\n\n## Notes\n- The provided example usage is for demonstration purposes only and might not cover all possible scenarios. Consider writing more comprehensive tests to validate the correctness of your `BankAccount` and its subclasses.\n\n- Be sure to handle edge cases, such as negative debit amounts or negative interest rates, appropriately in your implementations.\n- Comment your code adequately, explaining your thought process and any assumptions you make during implementation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathush-kumar%2Fbankaccount-java-abstract-class","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprathush-kumar%2Fbankaccount-java-abstract-class","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathush-kumar%2Fbankaccount-java-abstract-class/lists"}