Friday, April 24, 2026

Program to read and display array elements

#include<stdio.h>
void main()
{
    int a[50]; int n,i;

    do
    {
        printf("\nEnter no. of elements in between 1 and 50: ");
        scanf("%d",&n);
    }while(n<1 || n>50);

    printf("\nEnter the elements");
    for(i=0;i<n;i++)
        scanf("%d",&a[i]);

    printf("\nElements are ");
    for(i=0;i<n;i++)
        printf("%d ",a[i]);

    getch();
}

Monday, August 22, 2022

 //Account Class

class Account

{  

   int acc_no;  

   String name;  

   float amount;  

 

   void insert(int a,String n,float amt)

   {  

      acc_no=a;  

      name=n;  

      amount=amt;  

   }  


   void deposit(float amt)

   {  

      amount=amount+amt;  

      System.out.println(amt+" deposited");  

   }  


   void withdraw(float amt)

   {  

   if(amount<amt)

      {  

         System.out.println("Insufficient Balance");  

      }

   else

      {  

      amount=amount-amt;  

      System.out.println(amt+" withdrawn");  

      }  

   }  

 

   void checkBalance()

   {

      System.out.println("Balance is: "+amount);

   }  

 

   void display()

   {

      System.out.println(acc_no+" "+name+" "+amount);

   }  

}  


class AccountTest

{  

   public static void main(String[] args)

   {  

      Account a1=new Account();  

      a1.insert(10001,"Srikanth",1000);  

      a1.display();  

      a1.checkBalance();  

      a1.deposit(40000);  

      a1.checkBalance();  

      a1.withdraw(15000);  

      a1.checkBalance();  

   }

 

  1. //Student Class for Practice
  2. class Student
  3. {  
  4.      int rollno;  
  5.      String name;  
  6.      void insertRecord(int rno, String na)
  7.      {  
  8.             rollno=rno;  
  9.             name=na;  
  10.      }  
  11.      void displayInformation()
  12.      {
  13.             System.out.println("Student Details: "+rollno+"  "+name);
  14.      }  
  15. }  
  16. class TestStudent
  17. {  
  18.      public static void main(String args[])
  19.      {  
  20.         Student s1=new Student();  
  21.         Student s2=new Student();  
  22.   
  23.         s1.insertRecord(302,"Dinesh");  
  24.         s2.insertRecord(348,"Geetheswar");  
  25.   
  26.         s1.displayInformation();  
  27.         s2.displayInformation();  
  28.     }  
  29. }  

Friday, August 5, 2022

 Assignment: 1B: 

Define an Agent? Explain the same by taking Animals/Human Beings, Computer and Mobile as examples.  


Assignment: 1A: 
Conversion of 
Decimal Number --> Binary, Octal and Hexadecimal
and 
Binary, Octal and Hexadecimal --> Decimal Number

 Welcome to OOP Through JAVA Course.

Program to read and display array elements

#include<stdio.h> void main() {     int a[50]; int n,i;     do     {         printf("\nEnter no. of elements in between 1 and 50:...