Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USING JAVA LANGUAGE ! I WANT THE OPERATIONS IN THE MAIN BY SWITCH CASES PLEASE Complete the following tasks in Java within the lab time
USING JAVA LANGUAGE !
I WANT THE OPERATIONS IN THE MAIN BY SWITCH CASES PLEASE
Complete the following tasks in Java within the lab time using NetBeans. Create a project with yourName_ID_Lab# In this project, create a class called Account and has 2 instance variables: (1) ID as an Integer and (2) Balance as a Double. Your class should have a default constructor and a parametrized one 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. o Provide a set and a get method for each instant variable o Add a method called deposit that add an amount to the account's balance. It also should print the updated balance. Write a second class called TestAccount with a main method in this method you will create 3 objects 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 print the account details) and perform it. 2000 Please enter your account ID: 2345 Please enter your initial Balance: Select an operation: 1 : Show your Balance. 2: Deposit an amount. 3 : Print the account details. 4: To exit Your current balance is 2000.0 Select an operation: 1 : Show your Balance. 2: Deposit an amount. 3: Print the account details. 4: To exit Please enter an amount to deposit 20 Your updated balance is 2020.0 Select an operation: 1 : Show your Balance. 2: Deposit an amount. 3: Print the account details. 4: To exit Dear client, your account number is 2345 and your current balance is 2020.0 Select an operation: 1 : Show your Balance. 2: Deposit an amount. 3: Print the account details. 4: To exit BUILD SUCCESSFUL (total time: 20 seconds)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started