Create a class called Accounts which has data members like
ACCOUNT no, Customer name, Account type, Transaction type
(d/w), amount, balance
D->Deposit
W->Withdrawal
If transaction type is deposit call the credit(int amount)
and update balance in this method.
If transaction type is withdraw call debit(int amt) and
update balance.
Pass the other information like Account no,name,Account
Type through constructor.
Call the show data method to display the values.
Answer / abhinav agrawal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assignment3
{
internal class Accounts
{
public int ACCOUNTno;
public string CustomerName;
public string AccountType;
public string TransactionType;
public double amount;
public double balance = 1000;
public void Show()
{
Console.WriteLine("Enter Account Number:");
this.ACCOUNTno = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter Customer's Name:");
this.CustomerName = Console.ReadLine();
Console.WriteLine("Enter Account Type:");
this.AccountType = Console.ReadLine();
Console.WriteLine("Enter Transaction Type (d->deposit / w->withdrawal):");
this.TransactionType = Console.ReadLine();
Console.WriteLine("Enter Amount:");
this.amount = Convert.ToDouble(Console.ReadLine());
if(TransactionType=="d")
{
TransactionType = "Deposit";
balance = balance + amount;
} else if(TransactionType=="w" && amount < balance)
{
TransactionType = "Withdrawal";
balance = balance - amount;
} else if(TransactionType=="w" && amount > balance)
{
TransactionType = "Transaction is not possible.";
}
Console.WriteLine($"
Account Number: {ACCOUNTno} Customer's Name: {CustomerName} Account Type: {AccountType}
Transaction Type: {TransactionType} Amount: {amount} Remaining Balance: {balance}
");
}
public static void Main()
{
Accounts obj = new Accounts();
obj.Show();
}
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
Coding for Manipulate XML File Data Using C#?
Code for Reading and writing from a file?
How to Create Files by Using the FileInfo Class?
Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number.
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
Write a function which accepts a sentence as input parameter.Each word in that sentence is to be reversed. Space should be there between each words.Return the sentence with reversed words to main function and produce the required output. for eg:- i/p: jack jill jung kill o/p: kcaj llij gnuj llik
"c sharp" code for factorial using static variables
Create a class called Accounts which has data members like ACCOUNT no, Customer name, Account type, Transaction type (d/w), amount, balance D->Deposit W->Withdrawal If transaction type is deposit call the credit(int amount) and update balance in this method. If transaction type is withdraw call debit(int amt) and update balance. Pass the other information like Account no,name,Account Type through constructor. Call the show data method to display the values.
program to reverse the order of digits in a given number of any length.
How to export 2 datatables of a single dataset to 2 different worksheets of a single MSExcel file ?
how to get the table names via c sharp and column names also?