Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

EX2: Exercise #2: [15 marks] ACCOUNT Problem Statement: Design/Implement a Java class named Account that contains: Data fields: o An int data field named id

EX2:
image text in transcribed
image text in transcribed
Exercise #2: [15 marks] ACCOUNT Problem Statement: Design/Implement a Java class named Account that contains: Data fields: o An int data field named id for the account (default 0). o A double data field named balance for the account (default 0.0). O A double data field named annuallnterestRate that stores the current interest rate (default 0.0). Assume all accounts have the same interest rate. O A Date data field named dateCreated that stores the date when the account was created. (in order to use the Date class you have to import it as follows: import java.util.Date) Methods o A no-arg constructor that creates a default account. O A constructor that creates an account with the specified id, initial balance, and annual interest rate. o Methods to set and get id. o Methods to set and get balance. o Methods to set and get annuallnterestRate. o A method to get dateCreated. O A method named getMonthlyInterestRate() that returns the monthly interest rate. O A method named withdraw that withdraws a specified amount from the Account. o A method named deposit that deposits a specified amount to the account Write a Java test program that creates an Account object with an account ID of 1122, a balance of 20,000 SAR, and an annual interest rate of 4.5%. Use the withdraw method to withdraw 2,500 SAR, use the deposit method to deposit 3,000 SAR, and print the balance, the monthly interest, and the date when this account was created. A sample run: Your ID number is: 1122 Your Balance is: 20000.00 Your Annual Interest Rate is: 4.5 % The monthly Interest Rate is: 0.00375 The amount you want to withdraw is: 2500.00 Your New Balance is: 17500.00 The amount you want to deposit is: 3000.00 Your New Balance is: 20500.00 The date of creating the account is Sun Feb 24 08:16:12 AST 2013

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 Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

Students also viewed these Databases questions

Question

=+Show that un is finitely additive and countably subadditive on o.

Answered: 1 week ago