Home > Net >  O solve
O solve

Time:09-21

CodePudding user response:

This is to define a class, what difficult...

CodePudding user response:

The class Account
{
Public string [] AccountNumber {get; The set; }
Public string Name {get; The set; }
Public string ID {get; The set; }
Public double Balance {get; The set; }

Public void Deposit ()
{
}
Public void the Draw ()
{
}
Public void Transfer ()
{

}
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The static void Main (string [] args)
{

The Account a=new Account ();
String [] s_arry={" Account112233001 ", "Account112233002", "Account112233003"};
A.A ccountNumber=s_arry;
The foreach (string STR in a.A ccountNumber)
{
Console. WriteLine (STR);
}
Int result=a.A ccountNumber. Length;
Console. WriteLine (" common "+ result +" account ");
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

CodePudding user response:

refer to the second floor y95699111 response:
class Account
{
Public string [] AccountNumber {get; The set; }
Public string Name {get; The set; }
Public string ID {get; The set; }
Public double Balance {get; The set; }

Public void Deposit ()
{
}
Public void the Draw ()
{
}
Public void Transfer ()
{

}
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The static void Main (string [] args)
{

The Account a=new Account ();
String [] s_arry={" Account112233001 ", "Account112233002", "Account112233003"};
A.A ccountNumber=s_arry;
The foreach (string STR in a.A ccountNumber)
{
Console. WriteLine (STR);
}
Int result=a.A ccountNumber. Length;
Console. WriteLine (" common "+ result +" account ");
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Thank you very much, thank you thank you thank you

CodePudding user response:

refer to the second floor y95699111 response:
class Account
{
Public string [] AccountNumber {get; The set; }
Public string Name {get; The set; }
Public string ID {get; The set; }
Public double Balance {get; The set; }

Public void Deposit ()
{
}
Public void the Draw ()
{
}
Public void Transfer ()
{

}
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The static void Main (string [] args)
{

The Account a=new Account ();
String [] s_arry={" Account112233001 ", "Account112233002", "Account112233003"};
A.A ccountNumber=s_arry;
The foreach (string STR in a.A ccountNumber)
{
Console. WriteLine (STR);
}
Int result=a.A ccountNumber. Length;
Console. WriteLine (" common "+ result +" account ");
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
a few questions, first ID should uint is better, the Balance with a decimal, better accuracy
Second, AccountNumber should static, when user attributes, on the Banks should not instance, in the Account of the new method

CodePudding user response:

Using System;
using System.Collections.Generic;

The namespace ConsoleApp1
{
Class Program
{
The static void Main (string [] args)
{
The Account a=new Account (" * * ");
The Account b=new Account (" li si ");
The Account c=new Account (" detective ");
Console. WriteLine (" common "+ the AccountNumber +" Account ");
Console. WriteLine (" : ");
Foreach (string item in an Account. AccountNames)
{
Console. WriteLine (item);
}
Console.ReadLine();
}
}
The class Account
{
Private static uint id=100000000;//ID is automatically assigned, set the initial ID, each additional account, ID 1
Private static int accountNumber=0;
Public static int AccountNumber
{the get=& gt; AccountNumber. }
Private static List AccountNames=new List (a);
Public static List AccountNames {get=& gt; AccountNames; }
Public string Name {get; The set; }
Public uint ID {get; The set; }
Public double Balance {get; The set; }

Public Account (string name)
{
Name=Name;
AccountNumber++;//bank account of the total number of + 1
ID=id++;//assign ID
AccountNames. Add (name);
}
Public void Deposit (decimal num)
{

}
Public void the Draw (decimal num)
{
}
Public void Transfer (decimal num)
{

}
}
}
  •  Tags:  
  • C#
  • Related