Exp 2.1
Exp 2.1
Experiment 2.1
Student Name: Kaustabh Pal UID: 21BCS8791
Branch: CSE Section/Group: SC-905(B)
Semester: 6th Date of Performance: 22-02-24
Subject Name: JAVA LAB Subject Code: 21CSH-319
1. Aim: Create a program to collect and store all the cards to assist the users in
finding all the cards in a given symbol using Collection interface.
3. Input/Apparatus:
Hardware Requirements:- Minimum 384MB RAM, 100 GB hard disk,
processor with 2.1 MHz
4. Procedure:
import java.util.*;
class Card {
String symbol;
int number;
this.symbol = symbol;
this.number = number;
}
@Override
while (true) {
if (input.equalsIgnoreCase("done")) {
break;
if (parts.length != 2) {
continue;
int number;
try {
number = Integer.parseInt(parts[1]);
} catch (NumberFormatException e) {
int sum = 0;
sum += card.number;
scanner.close();
if (cardCollection.containsKey(card.symbol)) {
if (c.number == card.number) {
found = true;
break;
if (!found) {
cards.add(card);
} else {
cards.add(card);
cardCollection.put(card.symbol, cards);
5. Output: