

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
(The Account class) Design a class named Account that contains: An int data field named id for the account (default 0). A double data field named balance for the account (default 0). A double data field named annualInterestRate that stores the current interest rate (default 0). A Date data field named dateCreated that stores the date when the account was created. A constructor for initializing id, balance, and annualInterestRate and dateCreated. A method named getMonthlyInterestRate() that
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


...epos\BSIT3-2\Class_Activity\Class_Activity\Program.cs 1 //Rivas, Joy B. //BSIT 3- 2 using System; public class Account { int id = 0; double balance = 0; double annualInterestRate = 0; DateOnly dateCreated = new DateOnly(2022, 06, 02); public Account(int ID, double bal, double InterestRateValue) { balance = bal; id = ID; annualInterestRate = InterestRateValue; } public int getID() { return id; } public double getBalance() { return balance; } public double getannualInterestRate() { return annualInterestRate; } public DateOnly getdateCreated() { return dateCreated; } public double getMonthlyInterestRate() { double interest = annualInterestRate / 12; return interest; } public void withdraw(double withdrawAmount) { balance = balance - withdrawAmount; }
...epos\BSIT3-2\Class_Activity\Class_Activity\Program.cs 2 public void deposit(double depositAmount) { balance = balance + depositAmount; } public void displayBalance() { Console.WriteLine("Account Balance: Php {0}", getBalance()); } public void displayMonthlyInterest() { Console.WriteLine("Monthly Interest: {0}%", getMonthlyInterestRate()); } public void displaydateCreated() { Console.WriteLine("Account was created on: {0}", getdateCreated()); } public static void Main(String[] args) { Account myAccount = new Account(1122, 20000, 4.5); myAccount.withdraw(2500); myAccount.deposit(3000); myAccount.displayBalance(); myAccount.displayMonthlyInterest(); myAccount.displaydateCreated(); } }