Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 2:53 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 3 posts ] 
Author Question
 Question subject: Need help for my Java Programming Assignment urgently
PostPosted: Wed Nov 04, 2009 11:37 am 
Offline
Newbie
User avatar

Joined: Wed Nov 04, 2009 11:28 am
Posts: 2
Has thanked: 0 time
Have thanks: 0 time

Code:
/**
* @(#)Abbreviation.java
*
*
* @author
* @version 1.00 2009/11/2
*/


import java.util.*;
public class Abbreviation
{
     private String abbrName;
     private String[] fullNames = new String[10];
     
     Scanner sc = new Scanner (System.in);
 
      public Abbreviation()
      {}
     
     public  Abbreviation(String abbrName, String fullName)
     {   
        abbrName = abbrName;
         fullNames[0] = fullName;
     }
         
     public  Abbreviation(Abbreviation abbr)// copy Abbreviation data to abbrName
     {
        abbrName = abbr.getAbbrName();
        fullNames[0] = abbr.getFullName(abbr.getNumFullNames());
     }
public String getAbbrName()
     {
       return(abbrName);
     }
       
     public int getNumFullNames()
     {
         return(0); 
     }
       
     public String getFullName(int index)
     {
        return fullNames[index];
     }
       
     public boolean matchByAbbrName(String abbrName)
     {
        if (abbrName.equals(this.abbrName))
            return true;
   
           return false;
     }
       
     public boolean matchByAbbrPrefix(String abbrPrefix)
     {
        if (abbrPrefix.startsWith(this.abbrName))
            return true;
       
            return false;
     }
         
     public void addFullName(String fullName)
     {
       
     }
       
     public void print()
     {
        System.out.println("Abbreviation: [ "+abbrName+" ]");
       
          for (int i=0; i<fullNames.length; i++)
             System.out.println("[ "+fullNames[i]+" ]");
       
     }   
}


Code:
/**
* @(#)Database.java
*
*
* @author
* @version 1.00 2009/11/2
*/


import java.util.*;
import java.io.*;
public class Database
{
   private Abbreviation[] abbreviations;
   Abbreviation abbr;
     
   public  Database(String filename)   
   {
         String str1, str2;
         
         try
         {
            FileReader frStream = new FileReader("abbreviations.txt");
           BufferedReader brStream = new BufferedReader(frStream);
        
           for (int i=0; i<abbreviations.length; i++)   
           {
              String inputLine = brStream.readLine();
              
           }brStream.close();   
         }
         catch (Exception e)
         {
           System.out.println("Error opening the input file!!!");
       }      
   }
           
   public int getNumAbbreviations()
   { 

      for (int i=0; i<abbr.length; i++)
             return i;
   }
       
   public Abbreviation getAbbreviationByIndex(int index)
    {
      return null;
    }

    public void printAllAbbreviations()
    {
        //System.out.println(inputLine);
    }     
 
      public Abbreviation queryByAbbrName(String abbrName)
    {
        return null;   
    }
       
    public Abbreviation[] queryByAbbrPrefix(String abbrPrefix)
    {
        return null;
    }
       
}


Code:
/**
* @(#)MainApp.java
*
*
* @author
* @version 1.00 2009/11/2
*/


import java.util.*;
import java.lang.*;
import java.io.*;
public class MainApp
{
   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      
      InputStreamReader reader = new InputStreamReader(System.in);
      BufferedReader input= new BufferedReader(reader);
      
      int choice;

      String abbreviationsFile = "abbreviations.txt";
      System.out.println("Reading data set from ["+abbreviationsFile+"]");
   
      do{
         System.out.println("\nWelcome to Abbreviation System");
         System.out.println("==========================");
         System.out.println("0. Display this menu");
         System.out.println("1. List all abbreviations");
         System.out.println("2. Query abbreviation by exact match");
         System.out.println("3. Query abbreviation by prefix match");
         System.out.println("4. File translation");
         System.out.println("5. Abbreviation Quiz");
         System.out.println("9. Exit");
         System.out.print("Enter your choice: ");
         choice=sc.nextInt();

         switch(choice)
         {
            case 0:
                 break;
            
            case 1: database.printAllAbbreviations();
                   break;

            case 2:
                   break;

            case 3:
                   break;

            case 4:
                   break;

            case 5:
                   break;

            case 9: System.out.println("Program Terminating....");
                   break;       
            }
         }while(choice!=9);
      }
}


Attachments:
File comment: This is my assignment qns
Assignement 2.zip [76.96 KiB]
Downloaded 114 times
TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Need help for my Java Programming Assignment urgently
PostPosted: Wed Nov 04, 2009 2:05 pm 
Offline
Mastermind
User avatar

Joined: Tue Mar 27, 2007 10:55 pm
Posts: 2103
Location: Earth
Has thanked: 39 time
Have thanks: 57 time
please specify your java question , after you try by your self .

_________________
Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: Need help for my Java Programming Assignment urgently
PostPosted: Wed Nov 04, 2009 4:15 pm 
Offline
Newbie
User avatar

Joined: Wed Nov 04, 2009 11:28 am
Posts: 2
Has thanked: 0 time
Have thanks: 0 time
Honestly, After i did the Database.java, i have no idea how to start from there...I'm now still trying out, to see whether i can get the rite way... but not. I'm did not expect a solution from u... but to guide me on how to start... time is short for me.. so i did not give up trying.. but i also hope someone can help me...


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 3 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 Java seminar topic with demo  Java  Anonymous  1
 java project code  Java  Anonymous  0
 change Font of text in java  Java examples  msi_333  1
 Read your gmail using Java code  Java examples  msi_333  5
 programming  C-C++  Anonymous  0

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: Google Adsense [Bot] and 4 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team