0% found this document useful (0 votes)
37 views2 pages

Using Using Using Using Using Namespace Class: Accountcreditinformation

The code defines classes for credit and debit account information with methods to return balance credit or debit strings. The main method creates a debit information object and runs a loop prompting the user to enter C or D to call the appropriate credit or debit method and output the result, validating the input.

Uploaded by

Justin Salvador
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views2 pages

Using Using Using Using Using Namespace Class: Accountcreditinformation

The code defines classes for credit and debit account information with methods to return balance credit or debit strings. The main method creates a debit information object and runs a loop prompting the user to enter C or D to call the appropriate credit or debit method and output the result, validating the input.

Uploaded by

Justin Salvador
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XDDDD
{
class AccountCreditInformation
{

public string Credit()


{
return "Balance is Credited";
}
}
class DebitInformation : AccountCreditInformation
{

public string Debit()


{
return "Balance is Debited";
}
}

class Program
{
static void Main(string[] args)
{
DebitInformation x = new DebitInformation();

int incomplete = 1;
while (incomplete == 1)
{
Console.WriteLine("Determine whether the balance should be credited or
debited. C for Credit or D for Debit.");
char d = Console.ReadKey().KeyChar;
Console.WriteLine();
switch (d) //honestly recycled from my own code xddddd
{

case 'C':
case 'c':
Console.WriteLine(x.Credit());
incomplete--;
break;

case 'D':
case 'd':
Console.WriteLine(x.Debit());
incomplete--;
break;

default:
Console.WriteLine("Invalid Input! Try Again! ");
Console.WriteLine();
continue;

}
Console.ReadKey();
}
}
}

} //turns out this one was an essay. Second submission is the code + file

Output

You might also like