Task 3 - Constructors and Constructor Overloading

Junaid has decided to open new bank that would encourage savings and discourage expenses or spending; his target is to attract younger people. He has seed/surplus money to spend to gain customers. He has made following initial policies about the bank account:
  1. User should be ablet o open new account by providing cnic and age only. Or by providing name, cnic and age (String, String and int). If age is greater than 35, the balance (double) should be set to 0 because Junaid decided to give no money to people greater than 35. For rest, Junaid want to apply following formula on initial balance: 50,000 PKR initial balance for customers who have age between [20-25} years, 25000PKR for age between [25-30} years and only 10,000 for age between [30-35] years. User below 20 should not be able to open the account.
  2. He further want to encourage deposits and discourage withdraws. So whenever a customer deposit an amount, Junaid pays 5% of that amount from his own money (e.g. if customer deposit 500 PKR, the balance should be increased by 525PKR). And whenever, someone withdraw an amount, Junaid want to decrease his balance by 10% more (for example, if a customer withdraw 200 PKR, Junaid want to decrease 220PKR from customer account).
Create an Account class with above listed attributes, constructors, deposit, withdraw methods that implement listed policies and constraints. Encapsulate all fields and provide access via get/set methods but do not provide write access on balannce field. Write main method to demonstrate how it works for given input. Do not worry, if the balance become negative with particular sequence of transactions, after all this is fake bank. Please do not modify rules given above.


Popular posts from this blog

Task 12 - Create Java Program with MySQL Database Connectivity

Java Interfaces and Exception Handling - Practice Problem with Solution

Task 16 - Javafx Program to Create, Retrieve, Update and Delete records with Database