Write a program to add the Student Record in Java package inheritanceinjava; import java.util.ArrayList; import javax.swing.JOptionPane; public class InheritanceInJava { ArrayList<Student> students = new ArrayList<>(); while(true){ int option = mainMenu(); switch(option) { case 1: int i = Integer.parseInt(JOptionPane.showInputDialog("Enter the id :")); String n = JOptionPane.showInputDialog("Enter the name : "); float c = Float.pa...
Posts
Showing posts from November, 2022
- Get link
- X
- Other Apps
Write a program of ArrayList in Java import javax.swing.JOptionPane; public class InheritanceInJava { public static void main(String[] args) { ArrayList<Integer> ages = new ArrayList<>(); ages.add(25); ages.add(251); ages.add(2); ages.add(201); ages.add(22); ages.add(222); System.out.println("Total number of elements in List : "+ages.size()); ages.remove((Object)201); ages.remove((Object)222); for(int i=0; i<ages.size();i++) { System.out.println(ages.get(i)); ...
- Get link
- X
- Other Apps
Calculate the Area of Triangle and Rectangle using System; namespace Lab_Assignment { abstract class Shape { protected int Lenght; protected int Width; protected int Areaoftriangle; protected int Areaofrectangle; public Shape() { } public Shape(int lenght,int width) { this.Lenght = lenght; this.Width = width; } ...
- Get link
- X
- Other Apps
Double Linklist #include <iostream> #include <string.h> using namespace std; class Pas{ private: int id; string name; Pas* next; Pas* prev; public: Pas(int id, string name, Pas* next=NULL, Pas* prev=NULL){ SetId(id); SetName(name); SetNext(next); SetPrev(prev); } void SetId(int id){ this->id=id; } int GetId(){ return id; } void SetName(string name){ this->name=name; } string GetName(){ return name; } void SetNext(Pas* next){ this->next=next; } Pas* GetNext(){ return next; } void SetPrev(Pas* prev){ this->prev=prev; } Pas* GetPrev(){ return prev; } }; class Linklist{ private: Pas* head; Pas* tail; void delonhead(){ Pas* ptr = GetHead(); ptr->GetNext()->SetPrev(NULL); SetHead(ptr->GetNext()); delete ptr; } void delontail(){ Pas* ptr = GetTail(); ptr->GetPrev()->SetNext(NULL); ...