Skip to content

Instantly share code, notes, and snippets.

View PrajaktaSathe's full-sized avatar
👋
Hi there!

prajaktasathe PrajaktaSathe

👋
Hi there!
  • Planet Earth
View GitHub Profile
# Initialize an empty list -
my_queue = []
# Function to enqueue element
def enqueue(my_queue):
item = int(input("Enter element to enqueue: "))
my_queue.append(item)
# Function to dequeue element
def dequeue(my_queue):
#include <iostream>
using namespace std;
// class for individual node (you can also use struct)
class node {
public:
int data; // to store information/element
node *next; // points to the location of the next element
};
@PrajaktaSathe
PrajaktaSathe / Array_student.java
Created November 18, 2020 12:36
Program to demonstrate array of objects, take user input, display elements of array
// Program to demonstrate array of objects in Java -
package array;
import java.util.Scanner; // For taking user input
class Student {
private int rno, marks;
private String name;
// Function for getting data from user input -
public void getData() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter roll no: ");
@PrajaktaSathe
PrajaktaSathe / array_1.cpp
Created November 18, 2020 11:14
Program to demonstrate initializing of arrays, take user input, and display elements of the array
// Program to demonstrate initializing of arrays, take user input, and display elements of the array
#include <iostream>
using namespace std;
int main() {
char a[] = {'a', 'b', 'c', 'd', 'e'}; // initialize hard-coded char array (stores only characters)
int arr[5]; // initialize integer array of size 5
cout << "Enter array elements: " << endl; // displays message to enter array elements
// for loop, where iteration variable i is initialized to 0
// i goes on upto (not including) 5 (i.e. size of the array)
// i is incremented by 1 in every iteration
@PrajaktaSathe
PrajaktaSathe / AbstractClass.java
Created November 17, 2020 12:27
Program to demonstrate abstract classes in Java
// Program to demonstrate abstract classes in Java -
package abstractClass;
// No function definition can be added
// Objects of abstract class cannot be created,but object references can be created
// Syntax: abstract type method-name(parameter-list);
// abstract class class-name {}
// No abstract constructors
// Abstract class must be a subclass
abstract class area {
@PrajaktaSathe
PrajaktaSathe / BankSystem.java
Created November 17, 2020 12:24
Program to demonstrate bank account system
/* Case Study -
Using concepts of object-oriented programming develop solution for banking system having the following operations -
1. Create an account
2. Deposit money
3. Withdraw money
4. Honor daily withdrawal limit
5. Check the balance
6. Display account information
*/