Implement array of objects

Implement array of objects

import java.io.*;
import java.util.*;
public class dataa
{
    DataInputStream in=new DataInputStream(System.in);
    int i;
    int a[i]=int acid[5];
    String name1[i]=new String[5];
    float c[i]=new float bal[5];
    String name1;
    int a;
    public void print()
    {
        System.out.println("Enter Your Name:");
        name1=in.readLine();
    }


    public void comparename()
    {
        for(i=1;i<=5;i++)
        {
            if(name1.compareToIgnorecase(name[i]))
            {
                a=0;
            }
            if(a==0)
            {
                System.out.print("Your Account-ID:"+a[i]);
                System.out.println("Your Name:"+name[i]);
                System.out.println("Enter Balance:"+"Rs."+b[i]);
                break;
            }
        }
    }
}

class info
{
    public static void main(String args[])throws IOException
    {
        dataa A=new dataa();
        info();//default constructor
        info(acct_id[i],name[i],bal[i])//parameterized constructor
        {
            for(i=1;i<=5;i++)
            {
                System.out.print("Enter Account-ID:");
                acid[i]=Integer.parseInt(in.readLine());
                System.out.println("Enter Name:");
                name[i]=in.readLine();
                System.out.println("Enter Balance:"+"Rs.");
                bal[i]=Float.parsefloat(in.readLine());
            }
        };
        A.print();
        A.comparename();
    }
}
View Answers

April 9, 2012 at 5:37 PM

import java.io.*;

public class info
{
   static DataInputStream in=new DataInputStream(System.in);
   static  int acid[]=new int[5];
   static String name[]=new String[5];
    static float bal[]=new float[5];
    static String name1;
    static int a;
    public static void print()
    {
        try{
        System.out.print("Enter Your Name:");
        name1=in.readLine();
        }
        catch(Exception E){}
    }


    public static void comparename()
    {
        for(int i=0;i<5;i++)
        {
            if(name1.equalsIgnoreCase(name[i]))
            {
                a=0;
            }
            if(a==0)
            {
                System.out.println("Your Account-ID:"+acid[i]);
                System.out.println("Your Name:"+name[i]);
                System.out.println("Enter Balance:"+"Rs."+bal[i]);
                break;
            }
        }
    }


 public static void main(String args[])throws IOException  {


            for(int i=0;i<5;i++)
            {
                System.out.print("Enter Account-ID:");
                acid[i]=Integer.parseInt(in.readLine());
                System.out.print("Enter Name:");
                name[i]=in.readLine();
                System.out.print("Enter Balance:"+"Rs.");
                bal[i]=Float.parseFloat(in.readLine());
            }

      print();
       comparename();
    }
}









Related Tutorials/Questions & Answers:
Program to implement array of Objects.
Program to implement array of Objects.  Create a class it has.... Initialize an array of objects. Pass a name from the command line & search for the name in the array of objects , if it is existing print the information
program to implement array of objects
program to implement array of objects  import java.io.*; import java.util.*; public class dataa { DataInputStream in=new DataInputStream(System.in); int i; int a[i]=int acid[5]; String name1[i]=new String[5
Advertisements
Implement array of objects
Implement array of objects  import java.io.*; import java.util.*; public class dataa { DataInputStream in=new DataInputStream(System.in); int i; int a[i]=int acid[5]; String name1[i]=new String[5
Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects.
Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects.  Is there a way to find the primary key(s) for an Access Database table? Sun's JDBC-ODBC driver does not implement
JSON array objects retrieval in javascript
JSON array objects retrieval in javascript   I am fetching some data from database and want to show these values in a combo in javascript but combo box is not populating any value, perhaps i am doing something wrong in json
retrieve JSON array objects in javascript
retrieve JSON array objects in javascript  I am getting one value by JSON array, but how can i store multiple values in json array and how can i retieve it by javascript? Any help please auto.jsp <script type="text
declare a variable that will store an array of 5 objects
declare a variable that will store an array of 5 objects  Q7. Give a declaration for a variable that will 'store' an array of 5 Card objects... you   Declare Array of 5 objects in the following way: int list[]=new
saving form bean with Array of objects (collection) - Struts
saving form bean with Array of objects (collection)  Hi all... thanks..:) I am facing problem to capture my array of objects(Order) in form bean... an array of objects(Order.java) Order.java (java bean)- value object implements
JavaScript array of objects
JavaScript array of objects   ... that help you in understanding JavaScript array of objects. For this we are using... that is used to instantiate an array object and is initialized with various list
Creating Array Objects in JavaScript with JSON
Creating Array Objects in JavaScript with JSON... in this tutorial we have provided you the way array of objects are declared...; which contains two array objects "Maths" and "Science"
Insert an array list of objects with addAll(ArrayList) method
Insert an array list of objects with addAll(ArrayList) method In this section you will learn to insert an array list of objects to another list. Here is an example that provides the usage of the addAll(Arrayist
JavaScript array queue
JavaScript array queue       In the JavaScript array we can implement the Queue by using the push... will demonstrate you how to implement Queue by using the JavaScript array methods as follows
in_array
in_array  in_array in php
is _array()
is _array()  is_array() in php   Hi Friend, This function is of Boolean type.It checks whether a variable is an array or not. Here is an example: <?php $yes = array('Hello', 'World'); echo is_array($yes) ? 'Array
is _array()
is _array()  is _array()   Hi Friend, This function is of Boolean type.It checks whether a variable is an array or not. Here is an example: <?php $yes = array('Hello', 'World'); echo is_array($yes) ? 'Array
Array
Array  how can i use elements of an array in a circular form? that is if the searching of the element reach the last elements of the array, then it will start serching from the begining of the array
Array
Array  is it possible to define array like this..? int[] intArray = new int[] {4,5,6,7,8}; Explain...?   Yes, you can. Java Initialize Array
Array
Array  What if i will not declare the limit index of an array, how will I declare an array and store values with it using loop?   Hi Friend... Scanner(System.in); int array[]=new int[5]; System.out.println("Enter
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
Array
Array  How do i insert elements into an array up to a limit from...("Enter Range: "); int size=input.nextInt(); int array[]=new int[size]; System.out.println("Enter Array Elements: "); for(int i=0;i<
array
array  WAP in java to store 6 element in array P and 4 element in array Q. Produce the third arra y R containing all element from p & q
Implement push
Implement push  Hi.. How do you implement push on a flex applications? give me answer with example so i clearly understand Thanks  Ans: push implement on a flex applications using BlazeDS Server
Objective C Array
and remove the objects from the given list of array if the array is declared mutable... also add or insert more objects in an array even after declaring...Objective C Array In a simple term we can say that array is a object, which
Array
Array  can we create an array of size 1 lakh in java programming
array
array  array memory allocation is dynamic or static in java   Java Arrays have dynamic memory allocation
array
array  create an array in which no element is duplicate. if duplicate then tell to user duplicate. duplicacy is tell to user during when he enter the element
array
array  create an array in which no element is duplicate. if duplicate then tell to user duplicate. duplicacy is tell to user during when he enter the element
array
array  take a 2d array and display all its elements in a matrix fome using only one for loop and ple explain the program in below
array
accepts a pointer to integer which represents an array of integer.After that this method prints the entire of the array numbers to the monitor. include using std::cout; using std::endl; void printArray(int *array, int count
array
array  How to store the results of mysql query in an array... qurey in array: "select distinct(EMPLID)from tblwork where EMPLID not in (select... store the result in array
JavaScript array remove by index
JavaScript array remove by index       As in the previous example of JavaScript array we have described how one can use the pop() method to implement the remove() method
Implement push
Implement push  hi....... just tell me about How do you implement push with flex data services? give me answer with example Thanks  Ans: Using BlazeDS Server and Live Cycle Data Services
array
array  wap to calculate reverse of 10 elements in an array?  ...(); } System.out.print("Array is: "); for(int i=0;i<arr.length;i...(); System.out.print("After reversing, Array is: "); for(int i=arr.length-1;i>=0
Array's
Array's  I have to finish an "order page". that checks 2 dropdown boxes and a set of radio buttons and put the results into a set of textboxes, 1 line at a time, then calculate a total. I know I need to create an array, but I'm
array
array  Hi i have array like {1,2,3,4,,5,5,6,6} then how can i... is an example that store some integers into an array and find the occurrence of each number from the array. import java.util.*; public class SearchNumberOccurrence
array
array  how to getting values and storing values in array by using datainputstream?   Hi Friend, Try the following code:ADS_TO_REPLACE_1...("Array Elements are: "); for(int i=0;i<arr.length;i
Array
reserved. Use a one-dimensional array of primitive type Boolean to represent the seating chart of the cinema theater. Initialize all the elements of the array... the corresponding elements of the array to true to indicate that the seat is no longer
C Array of String
C Array of String       In this section you will learn how to create an array of string in C. A String is an array of char objects. An array of string can be declared
java: implement a class queue
java: implement a class queue  Implement a class Queue which supports.... You can use an array as your basic data structure and set its size to 100... not allowed to move around any elements inside the array. Instead use two integers front
Implement the Serializable Interface
Implement the Serializable Interface  hii How many methods do u implement if implement the Serializable Interface?   hiii,ADS_TO_REPLACE_1... of its own to implement
Implement an interface in a JSP
Implement an interface in a JSP  Can we implement an interface in a JSP?   
Implement transaction serializability
Implement transaction serializability  I need to implement transaction serializability in Java using semaphores/monnitors. What is the code to do
JavaScript array replace element
JavaScript array replace element       In the JavaScript array there is not any in-built replace() methods for replacing elements but we can implement replace
Array Implementation in C
Array Implementation in C Code: #include<stdio.h> #include<conio.h> void main() { void read(int *,int); void display(int *,int); int... for an array \n"); read(size,5); printf("All elements of the array
Where to implement spring - Spring
Where to implement spring   Hi, Where we implement spring framework in j2ee appplication. I mean which layer .Thanks
Implement This Skeleton Code
Implement This Skeleton Code  package jp.co.worksap.global; import... first-in-first-out (FIFO) queue of objects. * @param <E> */ public class...; } /** * Returns the number of objects in this queue. * @return */ public int size
Implement The Skeleton Code
Implement The Skeleton Code  package jp.co.worksap.global; import... first-in-first-out (FIFO) queue of objects. @param <E> */ public class... of objects in this queue. @return */ public int size() { return -1
implement microsoft office
implement microsoft office   how implement microsoft office in my java swing project ,or when microsoft office is not install then file open in defualt text editar.please send me source code

Ads