{"id":26913805,"url":"https://github.com/prathush-kumar/savings_account","last_synced_at":"2026-05-03T13:42:16.435Z","repository":{"id":283498064,"uuid":"951968242","full_name":"Prathush-Kumar/Savings_Account","owner":"Prathush-Kumar","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-28T15:42:41.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T16:36:34.832Z","etag":null,"topics":["java","object-oriented-programming","oops-in-java"],"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-20T14:23:45.000Z","updated_at":"2025-03-28T15:42:44.000Z","dependencies_parsed_at":"2025-03-20T15:35:06.499Z","dependency_job_id":"445f333b-aa62-4764-8ed3-aa2cd32b57e8","html_url":"https://github.com/Prathush-Kumar/Savings_Account","commit_stats":null,"previous_names":["prathush-kumar/savings_account"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FSavings_Account","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FSavings_Account/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FSavings_Account/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Prathush-Kumar%2FSavings_Account/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Prathush-Kumar","download_url":"https://codeload.github.com/Prathush-Kumar/Savings_Account/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246674032,"owners_count":20815671,"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":["java","object-oriented-programming","oops-in-java"],"created_at":"2025-04-01T16:48:32.252Z","updated_at":"2026-05-03T13:42:16.430Z","avatar_url":"https://github.com/Prathush-Kumar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SavingsAccount Java 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- Implementing inheritance in Java\n- Overriding methods in subclasses\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 class named `SavingsAccount` in Java, which inherits (extends) the `BankAccount` class. The `SavingsAccount` class has specific fields and methods as described below, and it overrides and implements the abstract methods defined in the `BankAccount` base class.\n\n### SavingsAccount Inherits BankAccount Class Diagram\n\n![SavingsAccountUML](https://github.com/user-attachments/assets/5231456a-6e78-41a7-9b16-9fa88729684e)\n\n\n### Structure of the Fields\nAs described by the UML Class Diagram, your `SavingsAccount` class has no additional required fields.\n\n### Structure of the Methods\nAs described by the UML Class Diagram, your `SavingsAccount` class must have the following methods:\n```java\npublic boolean debit(int amount);\npublic void applyInterest();\npublic String accountInfo();\n```\n\n### Behavior of the Methods\n1. The `debit` method should subtract the `amount` argument from the balance but only if the amount is not more than the balance. This method should return `true` if the amount was subtracted from the balance; otherwise, it should return `false`.\n\n2. The `applyInterest` method should compute the interest amount and add this amount to the balance but only if the balance is greater than 0. The interest amount is calculated by multiplying the balance by the interest rate (e.g., if the interest rate is 0.02, the interest amount is `balance * 0.02`).\n3. When applying interest, the interest amount is always added to the balance, and any fractional part will be rounded down (i.e., truncated).\n4. Interest will not be applied to any Savings or Checking account with a balance of zero or less.\n5. The `accountInfo` method will return a string formatted exactly like this:\n```\nType of Account : Savings\nAccount ID      : 1111-2222-3333-4444\nCurrent Balance : $123.45\nInterest rate   : 1.50%\n```\n\n### Additional Information\n- All bank accounts use balance, credit, and debit amounts, and fees stored and passed as a number of pennies (int).\n\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- When applying interest, the interest amount is calculated by multiplying the balance by the interest rate.\n- When applying interest, the interest amount is always added to the balance, and any fractional part will be rounded down.\n- Interest will not be applied to any Savings or Checking account with a balance of zero or less.\n- Debit methods will return false if the transaction cannot be made because of insufficient balance or insufficient credit limit. Otherwise, they will return true.\n- The credit method in the `BankAccount` base class will always return `true`.\n\n## Getting Started\n1. Create a new Java file named `SavingsAccount.java`.\n\n2. Define the `SavingsAccount` class that extends the `BankAccount` class.\n3. Implement the abstract methods (`debit`, `applyInterest`, and `accountInfo`) in the `SavingsAccount` class, overriding the respective methods from the `BankAccount` class.\n4. Test your `SavingsAccount` class by using the provided `TestAccount` and `Main` classes or by creating additional test cases.\n\n## Example Usage\n```java\n// Sample usage of SavingsAccount\npublic class Main {\n    public static void main(String[] args) {\n        // Example code to create and use a SavingsAccount\n        // (This is just a sample and not a comprehensive test)\n\n        // Creating a SavingsAccount\n        SavingsAccount savingsAccount = new SavingsAccount(\"1111-2222-3333-4444\");\n        savingsAccount.setInterestRate(0.015); // Set a 1.5% interest rate\n        savingsAccount.credit(1000); // Credit 1000 pennies (i.e., $10)\n        savingsAccount.applyInterest(); // Apply the interest rate\n        System.out.println(savingsAccount.accountInfo());\n\n        // Try to debit an amount larger than the balance\n        boolean debitSuccess = savingsAccount.debit(1500); // Try to debit 1500 pennies (i.e., $15)\n        System.out.println(\"Debit success: \" + debitSuccess);\n        System.out.println(\"Current Balance: \" + savingsAccount.getBalance());\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 `SavingsAccount` class.\n\n- Be sure to handle edge cases, such as applying interest to a zero or negative balance, or attempting to debit more than the balance, 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%2Fsavings_account","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprathush-kumar%2Fsavings_account","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprathush-kumar%2Fsavings_account/lists"}