Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need a solution that is inside the red .. I need a solution of the main Create a class called Account and has 2

I need a solution that is inside the red .. I need a solution of the main
image text in transcribed
image text in transcribed
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 accounts 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 dated 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. Olet Please enter your account ID Please enter your initial Balance 500 select an operation: 1 how your Balance 2 t Deposit an amount. 3 withdraw an amount 4 To exit Your choiset 1 Your current balance is 500.0 Select an operation 1 show your Balance 2. Deposit an amount. 3 withdraw A amount You chose 2 Please enter an amount to deposit 200 Your updated balance is 700.0 Select an operation 11 Show your balance 2. Deposit an amount 3 withdraw as amount To exit Your choice Inter the amount you want to withdraw: 800 The debt anunt exceeded account balance would you like to try another count 10 to exit, 1 to contine) 1 Enter the amount you want to withdraws 700 Your updated balance 1 0.0 Select an operation: 1 Show Your Balance 2 Deposit an amount 3Withdraw an amount 4 To exit Your choice 4 BUILD SUCCESSFUL total time: 1 minute 30 seconds)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago