Total members 11893 |It is currently Tue Nov 05, 2024 4:23 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Abbreviations System java
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 837 times
Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time

please specify your java question , after you try by your self .

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 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...


Author:
Newbie
User avatar Posts: 2
Have thanks: 0 time

import java.io.*;
import java.util.Scanner;

class RandomNumbers{
public static void main(String[] args){
Scanner reader = new Scanner(new File("numbers.dat"));
double number, sum = 0;
int count = 0;

while (reader.hasNext()){
double number > 0 && < 100;
}
}
}


Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 4 posts ] 

  Related Posts  to : Abbreviations System java
 adding abbreviations to your html     -  
 mail system in java     -  
 How to get system time in java     -  
 Customer Controls System in Java     -  
 code for online payment system in java     -  
 how to create a photo management system using java     -  
 chat system project in java using netbeans     -  
 Java Library Database Management System Project     -  
 Java System Tray Application using Visual Basic     -  
 The operating system using PHP     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com