Question: Complete the following tasks in Java using NetBeans. Create a class called Account and has 2 instance variables 1. ID as an Integer 2. Balance
Complete the following tasks in Java using NetBeans. Create a class called Account and has 2 instance variables 1. ID as an Integer 2. Balance as a Double Your class should have a constructor that take the ID and an initial Balance and use it to initialize the balance amount. Your constructor should validate that the initial Balance is greater than 0, otherwise balance should be initialized to the default value 0.0. Provide a set and a get method for each instant variable Add a method called deposit that add an amount to the account's balance. It also should print the updated balance. Add a method called debit that withdraws money from an account. Ensures that the debit amount does not exceed the account's and if it does the method should keep the balance as it is and print a message to the user indicating that The debit amount exceeded account balance". Then the method should ask the user to enter another amount or (0) to exit. If the withdraw amount is correct the method should print the updated balance. Write a class called TestAccount with a main method in this method you will create an object of the class account. Prompt the user to enter the id and the initial balance Then ask the user for the wanted operation (show balance, deposit or debit) and perform it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
