Convert to C# Language def Deposit(balance, pin): # Deposit function p = int(input("Enter the PIN: ")) # taking PIN from user if p == pin: # if PIN matches with actual PIN amount = float(input("Enter deposit amount: ")) # taking deposit amount from user balance += amount # adding deposit amount to balance else: # else (if PIN not matches) print("Incorrect PIN!!") # display message return balance # return balance
Convert to C# Language def Deposit(balance, pin): # Deposit function p = int(input("Enter the PIN: ")) # taking PIN from user if p == pin: # if PIN matches with actual PIN amount = float(input("Enter deposit amount: ")) # taking deposit amount from user balance += amount # adding deposit amount to balance else: # else (if PIN not matches) print("Incorrect PIN!!") # display message return balance # return balance
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Convert to C# Language
def Deposit(balance, pin): # Deposit function
p = int(input("Enter the PIN: ")) # taking PIN from user
if p == pin: # if PIN matches with actual PIN
amount = float(input("Enter deposit amount: ")) # taking deposit amount from user
balance += amount # adding deposit amount to balance
else: # else (if PIN not matches)
print("Incorrect PIN!!") # display message
return balance # return balance
def Withdraw(balance, pin): # Withdraw function
p = int(input("Enter the PIN: ")) # taking PIN from user
if p == pin: # if PIN matches with actual PIN
amount = float(input("Enter withdraw amount: ")) # taking withdrawal amount from user
if amount > balance: # if withdraw amount > balance
print("Insufficient Balance") # print insufficient balance
else: # else (if withdraw amount <= balance)
balance -= amount # subtracting deposit amount from balance
else: # else (if PIN not matches)
print("Incorrect PIN!!") # display message
return balance # return balance
def Inquire(balance, pin): # Inquire function
p = int(input("Enter the PIN: ")) # taking PIN from user
if p == pin: # if PIN matches with actual PIN
print("The outstanding balance is =", balance) # display the outstanding balance
else: # else (if PIN not matches)
print("Incorrect PIN!!") # display message
# main program
# taking initial amount from user
initial_amount = float(input("Enter an outstanding balance as initial amount: "))
while True: # infinite while loop
pin = int(input("Enter a 4 digit PIN: ")) # taking PIN from user for the first time
if len(str(pin)) != 4: # if PIN is not 4 digit
print("Invalid PIN!! PIN must be of 4 digit.") # display message
else: # else (if PIN is of 4 digit)
break # break the infinite while loop
print("1. Deposit\n2. Withdraw\n3. Inquire\n4. Exit") # display statement
while True: # infinite while loop
ch = int(input("Enter your choice (1-4): ")) # taking choice from user
if ch == 1: # if ch = 1
initial_amount = Deposit(initial_amount, pin) # calling Deposit function
elif ch == 2: # if ch = 2
initial_amount = Withdraw(initial_amount, pin) # calling Withdraw function
elif ch == 3: # if ch = 3
Inquire(initial_amount, pin) # calling Inquire function
elif ch == 4: # if ch = 4
print("Exiting...") # print exit message
break # break the infinite while loop
else: # else (choice other than 1/2/3/4)
print("Invalid Choice!!") # display message
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education