Rabu, 13 Maret 2013

EntryImp pada Book Address pada bahasa Java

import java.io.*;

public class EntryImp
{
    public static void main(String[] args) throws Exception
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String jumlah=null;
        int add;

        System.out.print("Input number of entry you want to add: ");
        jumlah = in.readLine();
        add = Integer.parseInt(jumlah);

        for (int i=0; i<add; i++)
        {
            if (add>1)
            {
                System.out.println("Input entry NO"+(i+1)+" now.");
            }
            String name=null, address=null, phone=null, email=null;
            System.out.print("Name: ");
            name = in.readLine();
            System.out.print("Address: ");
            address = in.readLine();
            System.out.print("Phone: ");
            phone = in.readLine();
            System.out.print("E-mail: ");
            email = in.readLine();

            EntryAdd newEntry = new EntryAdd();
            newEntry.setEntry(name, address, phone, email, i);

            System.out.println();
            System.out.println(" _________________________________ ");
            System.out.println(" ____________ENTRY_NO"+(i+1)+"____________");
            System.out.println("  Name        :  "+newEntry.getName(i));
            System.out.println("  Address    :  "+newEntry.getAddress(i));
            System.out.println("  Phone        :  "+newEntry.getPhone(i));
            System.out.println("  E-mail    :  "+newEntry.getEmail(i));
            System.out.println(" _______________END_______________");
            System.out.println();
           
        }
        System.out.println("Total entries registered: "+add+" entries.");
    }
}

Tidak ada komentar:

Posting Komentar