PLEASE ANSWER USING C You are a programmer for the Home JMSB

PLEASE ANSWER USING C#

You are a programmer for the Home JMSB Bank. You have been assigned to develop a class that models the basic workings of a bank account. The class should have the following properties Balance: Holds the current account balance IntRate Interest Holds the interest rate for the period Holds the interest earned for the current period .Transactions: Holds the number of transactions for the current period Write at least three constructors. Include properties for each of the data items Create a second class that instantiates the first class with information about your account The class should also have the following methods MakeDeposit Takes an argument, which is the amount of the deposit. This argument is added to the Balance property Another method to Display transaction and Display the new balance Sample run JMSB Bank Current Account Details Transaction Number: 3 Current Balance: 1000.00 Interest Rate: 0.15 Interest Earned: 150.00 Make Deposit Deposit 100.06e New Balance: 1100.e0 Press any key to go to the Account Update Calulator

Solution

using System;

class Account
{
   private double balance;
   private double rate;
   private double interest;
   private int transaction;

   public Account()   //default constructor
   {
       balance = 0.0;
       rate = 0.0;
       interest = 0.0;
       transaction = 0;
   }
   public Account(double balance,double rate,int transaction) //parameterized constructor
   {
       this.balance = balance;
       this.rate = rate;
       this.interest = balance*rate;
       this.transaction = transaction;
   }
       public Account(Account a)    //copy constructor
   {
       this.balance = a.balance;
       this.rate = a.rate;
       this.interest = a.interest;
       this.transaction = a.transaction;
   }

   //properties
   public double Balance
   {
       get{return balance;}
       set{balance = value;}
   }
   public double IntRate
   {
       get{return rate;}
       set{rate = value;}
   }
   public double Interest
   {
       get{return interest;}
       set{interest = value;}
   }
   public int Transaction
   {
       get{return transaction;}
       set{transaction = value;}
   }

   public void MakeDeposit(double amount) //deposit amount
   {
       balance = balance + amount;
       Console.WriteLine(\"\ Make Deposit\");
       Console.WriteLine(\"Deposit : \"+ amount);
       Console.WriteLine(\"New Balance : \"+ balance);
    
   }
   public void Display()   //display details
   {
       Console.WriteLine(\"\ Current Account Details \ Transaction Number : \"+transaction +\"\ Current Balance : \"+balance +\"\ Interest Rate : \"+rate +\"\ Interest Earned : \"+interest);
   }
}

public class Test
{
   public static void Main()
   {
    Console.WriteLine(\"Please Enter Current Balance : \");
    double balance = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine(\"Please Enter Deposit Amount : \");
    double amount = Convert.ToDouble(Console.ReadLine());
    Console.WriteLine(\"Please Enter Transaction Number : \");
    int tno = Convert.ToInt32(Console.ReadLine());
    Console.WriteLine(\"Please Enter Interest Rate(in %) : \");
    double rate = Convert.ToDouble(Console.ReadLine());
   
       Account a1 = new Account(balance,rate,tno);
       a1.Display();
       a1.MakeDeposit(amount);
    
   }
}


Output:

PLEASE ANSWER USING C# You are a programmer for the Home JMSB Bank. You have been assigned to develop a class that models the basic workings of a bank account.
PLEASE ANSWER USING C# You are a programmer for the Home JMSB Bank. You have been assigned to develop a class that models the basic workings of a bank account.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site