Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use the software visual Studio and c # language to solve the question, please. This exercise will be exploring more usage of the static keyword.

use the software "visual Studio" and c # language to solve the question, please.

image text in transcribed

image text in transcribed

This exercise will be exploring more usage of the static keyword. Properties: Balance - this property is a double that represents the current balance of this You must follow the specifications exactly. account. The getter is public and the setter is private. Names - this property is a list of string representing the name associated with this The Account class account. The getter is public and the setter is private. This is the front end of the application. There are 12 members. Constructor: There are two constructors for this class: a static that is called before any member is accessed and a private one to prevent object instantiation outside of class. name, double balance) - This is a private constructor that does the following: - The Number field and the Balance property are initialized to the values of the arguments - The Names property is initialised to an empty list (use the new operator). And the argument is added to this collection Methods public static Account CreateAccount(string name, double balance = 500) - This is a public static method is used to create accounts. It does the following: - Builds an account number from the TRANSIT_NUMBER and nextAccountNumber according to the template "AC-[transit number]-[current account number]. e.g. if the value of TRANSIT_NUMBER and nextAccountNumber are 314 and 10005 respectively then the account number will be "AC-314-10005". Description of class members - It also increments the nextAccountNumber field so the next object will have a Constants: unique number. TRANSIT_NUMBER - this private representing the branch number of That is initialized to 314 . It is used - Instantiate a new account object with the appropriate arguments. CreateAccount () method to build the account number of this account. public void AddName(string name) - This is a public method adds the argument to the Names collection. It is possible to have multiple names associated Fields: with this account. This method does not return a value. nextAccountNumber - this private class variable is an int representing the unique number to be used when creating a new account. This is initialized in the static public void Deposit(double amount) - This is a public method that increases constructor. This is incremented in the instance constructor the property Balance by the amount specified by the argument. This method does not return a value. Number - this public instance variable is a string indicating the current account number of this object reference. This must be decorated with the readonly keyword. This is set in the Account(string, string, double) method. method in the object class to return a stringify form of the object. To display the Names field, you will have to do some extra work because it is a list of strings [] Test Harness Test Harness Output Insert the following code statements in your Program.cs file: Note the following balances will be different from the following output

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 Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions