Vac - Java Programming 06 Sem
Vac - Java Programming 06 Sem
Course Objective
To impart knowledge on
• The principles and practice of object oriented analysis and design in the construction
of robust, maintainable programs which satisfy the requirements given
• Competence to design, write, compile, test and execute straightforward programs using a
high level language;
• Have an awareness of the need for a professional approach to design and the importance
of good documentation to the finished programs.
• To be able to implement, compile, test and run Java programs comprising more than
one class, to address a particular software problem.
PREREQUISITE:
1. Good programming knowledge in C++
2. Sound knowledge on the OOP Principles
3. Basic knowledge in Computer Networks
Introduction to Java – Features of java – JVM – API document – Naming conventions and Data types -
Data types in java – Operators
Classes and objects – Methods in java – Relationship between objects – Inheritance – Polymorphism -
Type casting – Abstract Classes – Interfaces – Packages -
Total Periods: 30
• Demonstrate the ability to employ various types of selection constructs in a Java program.
• Use built-in classes found in the Java API
• Create Java programs that leverage the object-oriented features of the Java language,
such as encapsulation, inheritance and polymorphism.
• Apply error-handling techniques using exception handling
• Provide solution to a given set of requirements using threads, multithreading and
synchronisation.
References :
1. [Link]
2. [Link] -with-examples/
3. [Link]
4. [Link]
Department of Computer Science and Engineering
S.
N Roll No Student Name Year/ Coordinator Resource Person
Reg. Number Course Name
Sem Name Name
o
1. 810622104001 22CS01 ABINAYA.P II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
2. 810622104002 22CS02 AKILA.B II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
3. 810622104004 22CS04 ARAVINTH.M II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
4. 810622104005 22CS05 ARAVINTH.V II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
5. 810622104006 22CS06 ARULKUMAR.A II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
6. 810622104007 22CS07 ARULMOZHI.K II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
7. 810622104008 22CS08 ASIKA.M II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
8. 810622104010 22CS10 BASKAR.B II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
9. 810622104011 22CS11 BAVAN.R II/VI JAVA T. Thendral Kani C. Selva Ganesan
PROGRAMMING
1 22CS01 ABINAYA.P
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
10 22CS13 DHIVYADHARSHINI.B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
18 SUBASH
22CS32
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 RAJESHWARI
24RCS42
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
10 22CS13 DHIVYADHARSHINI.B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
SUBASH
18 22CS32
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
10 22CS13 DHIVYADHARSHINI.B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
SUBASH
18 22CS32
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
DHIVYADHARSHINI.
10 22CS13
B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
SUBASH
18 22CS32
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
Department of Computer Science and Engineering
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
DHIVYADHARSHINI.
10 22CS13
B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
SUBASH
18 22CS32
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
10 22CS13 DHIVYADHARSHINI.B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
SUBASH
18 22CS32
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
PROGRAMME PARTICIPANTS / STUDENTS – FEEDBACK(Week-6)
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
DHIVYADHARSHINI.
10 22CS13
B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
18 22CS32 SUBASH
CHANDRABOSE.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
2 22CS02 AKILA.B
3 22CS04 ARAVINTH.M
4 22CS05 ARAVINTH.V
5 22CS06 ARULKUMAR.A
6 22CS07 ARULMOZHI.K
7 22CS08 ASIKA.M
8 22CS10 BASKAR.B
9 22CS11 BAVAN.R
10 22CS13 DHIVYADHARSHINI.B
11 22CS15 IHSANULLAH.M
12 22CS16 JAGAN.P
13 22CS17 KAVIYA.R
14 22CS19 LOKESHWARAN.B
16 22CS22 MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
19 22CS33 SUMITHRA.V
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 24RCS42 RAJESHWARI
Value Added Course : Java Programming
Duration : 30 Hours
Mode : Lectures
Target Audience : CSE
S.
Roll No Student Name Week 1 Week 2 Week 3 Week 4 Week 5
No
1 22CS01 ABINAYA.P
2 22CS02 AKILA.B
3 22CS04
ARAVINTH.M
4 22CS05
ARAVINTH.V
5 22CS06
ARULKUMAR.A
6 22CS07
ARULMOZHI.K
7 22CS08
ASIKA.M
8 22CS10
BASKAR.B
9 22CS11
BAVAN.R
10 22CS13 DHIVYADHARSHINI.B
11 22CS15
IHSANULLAH.M
12 22CS16
JAGAN.P
13 22CS17
KAVIYA.R
14 22CS19
LOKESHWARAN.B
15 22CS21
MOHAMED ALI.A
16 22CS22
MUGILAN.M
17 22CS23 MUTHUPANDIYAN.K
SUBASH
18 22CS32
CHANDRABOSE.K
SUMITHRA.V
19 22CS33
20 22CS34 TAMILSELVI S
21 22CS35 VAIDEKI.K
22 22CS37 VEERASEKAR.R
23 22CS40 VIJAYAKUMAR.R
24 23LCS301 KEERTHANA S
25 RAJESHWARI
24RCS42
Request Mail
Subject: Invitation as Resource Person for Value Added Course on Java Programming - Reg.
Dear Professor
We are pleased to inform you that the Department of Computer Science and Engineering & Dr. Navalar
Nedunchezhiyan College of Engineering, is organizing a Value Added Course (VAC) on Java
Programming for our students during 30 Hours (21 Feb 2025 to 10 may 2025) every week Saturday, The
course aims to provide participants with practical exposure and in-depth knowledge of Network Simulator.
Considering your expertise and valuable contributions in this field, we would be honored to invite you as a
Resource Person for this course. Your sessions will greatly enrich the learning experience of our students and
help bridge the gap between industry expectations and academic learning.
Mode: [Offline/Online]
We kindly request your acceptance to be the Resource Person and share your availability. An honorarium and
certificate of appreciation will be provided as a token of gratitude for your contribution.
We look forward to your positive response and guidance in making this initiative a great success.
Subject: Acceptance of Invitation as Resource Person – Value Added Course on Java Programming Design-
reg
Greetings!
I sincerely thank you and Dr. Navalar Nedunchezhiyan College of Engineering for inviting me to serve as a
Resource Person for the upcoming Value Added Course on Java Programming scheduled Proposed Dates:
[21.02.2025, 08.03.2025, 22.03.2025, 29.03.2025, 26.04.2025, 10.05.2025]. It is indeed an honor and
privilege to be associated with your institution and contribute to this academic initiative.
I am pleased to accept the invitation and confirm my availability for the program. I look forward to interacting
with the students and sharing my knowledge and experiences in the field of Java . Kindly share the detailed
schedule, session duration, and any specific topics you would like me to emphasize, so that I can prepare
accordingly.
Once again, thank you for this opportunity. I look forward to a fruitful engagement.
To
The Principal
Dr. Navalar Nedunchezhiyan College of Engineering
Tholudur Po,
Cuddalore Dt-606 303
Respected Madam
Sub: Request for Conducting a Value Added Course on Java Programming – Reg.
With due respect, I wish to bring to your kind attention that the Department of Computer Science and
Engineering, proposes to organize a Value Added Course (VAC) on the topic “Java Programming ” for the
benefit of our students.
The objective of this course "To develop platform-independent, secure, and object-oriented applications by
using the Java programming language, enabling robust software solutions for web, desktop, mobile, and
enterprise environments”.
We also propose to invite Mr. C. Selva Ganesan as the Resource Person for delivering expert lectures and
hands-on sessions. The course is planned to be conducted during [21.02.2025, 08.03.2025, 22.03.2025,
29.03.2025, 26.04.2025, 10.05.2025] for UG 3rd year students of our department.
In this regard, I kindly request your approval and necessary permission to conduct this Value Added Course at
our institution.
Thank you
Yours faithfully,
T.S. Raja
Head of the Department
Computer Science and Engineering,
Dr. Navalar Nedunchezhiyan College of Engineering
Date:01.04.2025 AN Register Number:
CIRCULAR
Date: 11.02.2025
It is hereby informed that a Value Added Course (VAC) on “Java Programming ” is being organized
by the Department of Computer Science and Engineering (CSE) for the benefit of students. The course will be
conducted from 21.02.2025 to 10.05.2025 with a total duration of 6 weeks.
Resource Person
All students of the department are requested to participate in this Value Added Course and make use
of the opportunity to enhance their knowledge and skills in the field of Java Programming.
Course Coordinator:
T. Thendral Kani
AP/CSE
Dr. Navalar Nedunchezhiyan College of Engineering
Principal
Copy to:
1. All HODs for staff & Students circulation
2. E-Circular I / C
3. Director AGI
4. Hostel warden – LH / BH
5. Event Coordinator
6. NSS& NCC - Coordinator
7. IQAC
8. Physical Director
9. Central Library
10. Transport I/C
11. Office File
12. Notice Board
Copy Submitted to the Director, AGI
CIA-I
Degree / Branch : B.E. Computer Science and Engineering
Java Programming
Course Code / Title : Java Programming Year / Semester : III / VI
Maximum Marks: 80 Hours:2.30 hrs
Answer all the Questions
PART A (10 x 2 = 20 Marks)
1 What is the difference between JDK, JRE, and JVM? CO1 BT4
11.a Develop a Java program to manage a student record system using classes and objects. CO1 BT6
(OR)
11.b Write a Java program to demonstrate multilevel inheritance. CO1 BT3
(OR)
12.b Explain exception handling in Java with a detailed program. CO1 BT1
13.a Write a Java program to implement multiple threads using the Runnable interface CO2 BT2
(OR)
13.b Design a Java application using interfaces and abstract classes.. CO2 BT1
14.a Develop a Java program using Swing or AWT to create a simple calculator GUI. CO2 BT5
(OR)
14.b Explain and implement the concept of collections in Java. CO2 BT5
15.a Create a Java program to demonstrate method overloading and overriding CO3 BT6
(OR)
15.b Write a Java program to simulate a banking application using classes and objects. CO3 BT4
COURSE OUTCOMES
To be attached:
***Answer script****
Any one student
******Answer key*****
Ans :
2
• Class: Blueprint for objects, defines properties & methods.
• Object: Instance of a class with real values
Ans :
3
• Method Overloading in Java means defining multiple methods with the same name but different
parameter lists (different number or types of parameters).
Ans:
4 • final variable: value cannot change.
• final method: cannot be overridden.
• final class: cannot be inherited.
Ans:
Ans:
6 • Platform independent.
• Object-oriented.
• Robust (memory management, exception handling).
• Secure
Ans:
7
• ==: compares references (memory location).
• .equals(): compares object content.
10 • Exception handling is the process of handling runtime errors in Java using try-catch blocks to prevent
abnormal program termination.
Develop a Java program to manage a student record system using classes and objects.
11.a
Ans:
Classes to define the blueprint of student records (fields and methods) and create objects to store
and manage multiple student details.
Program :
import [Link];
class Student {
int id;
String name;
double marks;
// Constructor
[Link] = id;
[Link] = name;
[Link] = marks;
void display() {
[Link]("ID: " + id + ", Name: " + name + ", Marks: " + marks);
[Link]();
[Link]();
Output :
Ans:
String name;
int age;
[Link] = name;
[Link] = age;
void displayPerson() {
int rollNo;
[Link] = rollNo;
void displayStudent() {
double marks;
[Link] = marks;
void displayResult() {
displayPerson();
displayStudent();
}
}
[Link]("Alice", 20);
[Link](101);
[Link](89.5);
[Link]();
Output :
Marks: 89.5
File handling in Java is done using classes like File, FileWriter, FileReader, BufferedReader.
We can perform operations such as create, write, and read files.
Program:
import [Link].*;
} catch (IOException e) {
[Link]("An error occurred.");
[Link]();
}
}
}
Output:
File created: [Link]
Successfully wrote to the file.
What it is: A mechanism to handle runtime errors so the program can continue or fail gracefully.
Hierarchy (simplified): Throwable → Exception (recoverable) & Error (generally
unrecoverable).
Common runtime (unchecked) exceptions extend RuntimeException (e.g.,
NullPointerException, NumberFormatException); checked exceptions (e.g., IOException) must
be declared/handled.
Keywords:
try (guard code) • catch (handle specific exceptions) • finally (always runs) • throw (create/raise
an exception) • throws (declare that a method may throw).
Patterns & tips:
Catch specific exceptions first, use finally for cleanup, create custom exceptions for business
rules, and prefer try-with-resources for auto-closing I/O.
import [Link].*;
Task(String name) {
[Link] = name;
}
@Override
public void run() {
for (int i = 1; i <= 5; i++) {
[Link](taskName + " - Count: " + i);
try {
[Link](500); // pause for half a second
} catch (InterruptedException e) {
[Link](taskName + " interrupted.");
}
}
[Link](taskName + " finished execution.");
}
}
13.b Design a Java application using interfaces and abstract classes. CO2 BT1
Ans:
An abstract class provides partial implementation (some methods defined, some abstract).
An interface defines only abstract methods (Java 8+ allows default and static methods too).
A Java application can combine both to achieve abstraction, modularity, and multiple
inheritance.
// Interface
interface Payable {
double calculatePay(); // abstract method
}
// Abstract class
abstract class Employee implements Payable {
String name;
int id;
// Concrete method
void displayInfo() {
[Link]("Employee ID: " + id + ", Name: " + name);
}
// Abstract method
abstract String getRole();
}
// Concrete subclass 1
class FullTimeEmployee extends Employee {
double salary;
@Override
public double calculatePay() {
return salary; // fixed salary
}
@Override
String getRole() {
return "Full-Time Employee";
}
}
// Concrete subclass 2
class PartTimeEmployee extends Employee {
int hoursWorked;
double hourlyRate;
@Override
public double calculatePay() {
return hoursWorked * hourlyRate;
}
@Override
String getRole() {
return "Part-Time Employee";
}
}
// Main class
public class EmployeeApp {
public static void main(String[] args) {
Employee e1 = new FullTimeEmployee("Alice", 101, 50000);
Employee e2 = new PartTimeEmployee("Bob", 102, 20, 500);
[Link]();
[Link]("Role: " + [Link]() + ", Pay: " + [Link]());
[Link]();
[Link]();
[Link]("Role: " + [Link]() + ", Pay: " + [Link]());
}
}
Output:
Employee ID: 101, Name: Alice
Role: Full-Time Employee, Pay: 50000.0
public CalculatorApp() {
// Frame settings
setTitle("Simple Calculator");
setSize(400, 250);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(5, 2, 10, 10));
// Components
input1 = new JTextField();
input2 = new JTextField();
result = new JTextField();
[Link](false);
setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
try {
double num1 = [Link]([Link]());
double num2 = [Link]([Link]());
double res = 0;
if ([Link]() == addBtn) {
res = num1 + num2;
} else if ([Link]() == subBtn) {
res = num1 - num2;
} else if ([Link]() == mulBtn) {
res = num1 * num2;
} else if ([Link]() == divBtn) {
if (num2 == 0) {
[Link](this, "Cannot divide by zero!");
return;
}
res = num1 / num2;
} else if ([Link]() == clearBtn) {
[Link]("");
[Link]("");
[Link]("");
return;
}
[Link]([Link](res));
14.b Explain and implement the concept of collections in Java. CO2 BT5
Ans:
The Java Collections Framework (JCF) is a set of classes and interfaces that implement
commonly used data structures like List, Set, Map, Queue.
Located in [Link] package.
Provides features like dynamic sizing, searching, sorting, iteration.
Key interfaces:
List → ordered collection, allows duplicates (e.g., ArrayList, LinkedList).
Set → unique elements, no duplicates (e.g., HashSet, TreeSet).
Map → key-value pairs (e.g., HashMap, TreeMap).
Advantages: reduces programming effort, improves performance, reusable, supports algorithms
(sort, shuffle).
import [Link].*;
// Traversing List
[Link]("\nTraversing List:");
for (String f : fruits) {
[Link](f);
}
// Traversing Map
[Link]("\nTraversing Map:");
for ([Link]<Integer, String> entry : [Link]()) {
[Link]("ID: " + [Link]() + ", Name: " + [Link]());
}
}
}
Output:
List: [Apple, Banana, Orange, Apple]
Set (Unique elements): [Banana, Orange, Apple]
Map (Student Records): {101=Alice, 102=Bob, 103=Charlie}
Traversing List:
Apple
Banana
Orange
Apple
Traversing Map:
ID: 101, Name: Alice
ID: 102, Name: Bob
ID: 103, Name: Charlie
15.a Create a Java program to demonstrate method overloading and overriding. CO3 BT6
Ans:
Method Overloading: Same method name but different parameter lists (compile-time
polymorphism).
class MathUtil {
// Method Overloading (same name, different parameters)
int add(int a, int b) {
return a + b;
}
// Parent class
class Animal {
void sound() {
[Link]("Animal makes a sound");
}
}
[Link]();
// Method Overriding
Animal a = new Animal();
Animal d = new Dog(); // Runtime polymorphism
15.b Write a Java program to simulate a banking application using classes and objects. CO3 BT4
Ans:
import [Link];
class BankAccount {
private String accountHolder;
private int accountNumber;
private double balance;
// Constructor
BankAccount(String accountHolder, int accountNumber, double balance) {
[Link] = accountHolder;
[Link] = accountNumber;
[Link] = balance;
}
// Deposit method
void deposit(double amount) {
if (amount > 0) {
balance += amount;
[Link]("Deposited: " + amount);
} else {
[Link]("Invalid deposit amount.");
}
}
// Withdraw method
void withdraw(double amount) {
if (amount > 0 && amount <= balance) {
balance -= amount;
[Link]("Withdrawn: " + amount);
} else {
[Link]("Insufficient balance or invalid amount.");
}
}
while (true) {
[Link]("\n--- Banking Menu ---");
[Link]("1. Deposit");
[Link]("2. Withdraw");
[Link]("3. Check Balance");
[Link]("4. Exit");
[Link]("Enter choice: ");
int choice = [Link]();
switch (choice) {
case 1:
[Link]("Enter amount to deposit: ");
double dep = [Link]();
[Link](dep);
break;
case 2:
[Link]("Enter amount to withdraw: ");
double wd = [Link]();
[Link](wd);
break;
case 3:
[Link]();
break;
case 4:
[Link]("Thank you for using Banking App!");
[Link]();
return;
default:
[Link]("Invalid choice.");
}
}
}
}
Output:
--- Banking Menu ---
1. Deposit
2. Withdraw
3. Check Balance
4. Exit
Enter choice: 1
Enter amount to deposit: 500
Deposited: 500.0