Computer Science
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
 
 

Display results as :
 


Rechercher Advanced Search

Keywords

Latest topics
» (2011Q2) ??????? ?????? ?41? ???????????!/????????????!?(TX 1280x720 X264 AAC).mp4
Program checking faculty absent list EmptySat Feb 15, 2014 10:12 am by doriperni

» Sync2 V2.20.1312 X86x64.rar.rar
Program checking faculty absent list EmptyFri Feb 14, 2014 7:37 pm by carmibire

» 9.1 Inheritance Hierarchies
Program checking faculty absent list EmptyTue Feb 26, 2013 12:50 pm by ThienDinh

» Useful website
Program checking faculty absent list EmptySat Dec 08, 2012 6:52 pm by tpham1991

» The Machine that Changed the World: Giant Brains. 1992 Documentary
Program checking faculty absent list EmptySat Dec 08, 2012 2:16 am by ThienDinh

» Problems in practice test.
Program checking faculty absent list EmptyThu Dec 06, 2012 2:32 pm by ThienDinh

» Newton's Method
Program checking faculty absent list EmptyMon Dec 03, 2012 8:32 pm by ThienDinh

» Console Calc
Program checking faculty absent list EmptySun Dec 02, 2012 5:57 pm by Petahwil

» Law Of Cosines
Program checking faculty absent list EmptySat Dec 01, 2012 4:54 pm by Petahwil

April 2024
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    

Calendar Calendar


Program checking faculty absent list

2 posters

Go down

Program checking faculty absent list Empty Program checking faculty absent list

Post by ThienDinh Fri Nov 30, 2012 8:21 pm

Reserved LOL Embarassed


Last edited by ThienDinh on Fri Nov 30, 2012 9:59 pm; edited 1 time in total

ThienDinh
Admin

Posts : 27
Join date : 2012-11-30

https://computerscienceqc.board-directory.net

Back to top Go down

Program checking faculty absent list Empty Program checking faculty absent list [Coming soon]

Post by Petahwil Fri Nov 30, 2012 8:29 pm

cyclops That Will Be Sick, And Very Useful!!

Petahwil

Posts : 8
Join date : 2012-11-30
Age : 31

Back to top Go down

Program checking faculty absent list Empty Re: Program checking faculty absent list

Post by ThienDinh Fri Nov 30, 2012 9:42 pm

OK, Just done the program!!! albino

Code:

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Scanner;

/**
 *
 * @author ThienDinh
 */
public class QCCAbsentList {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) throws MalformedURLException, IOException
    {
        // TODO code application logic here
        String address = "http://www2.qcc.mass.edu/facAbsence/default.asp";
        URL pageLocation = new URL(address);
        Scanner in = new Scanner(pageLocation.openStream());
        ArrayList<String> goodInputs = new ArrayList<>();
        String openTag = "<strong>";
        while (in.hasNextLine())
        {
            String line = in.nextLine();
            if (line.length() > openTag.length())
            {
                goodInputs.add(line);
            }
        }
        ArrayList<String> names =  getNames(goodInputs, openTag);
       
        System.out.println("Faculty Absence List:");
        for(int i = 0; i < names.size(); i++)
        {
            System.out.println(names.get(i));
        }
    }

    public static ArrayList<String> getNames(ArrayList<String> goodInputs, String openTag)
    {       
        ArrayList<String> names = new ArrayList<>();
        for (int index = 0; index < goodInputs.size(); index++) // Run lines
        {           
            int i = 0;
            int j = i + openTag.length() - 1;
            while(j < goodInputs.get(index).length())
            {
              String subString = goodInputs.get(index).substring(i, j + 1);
                if(subString.equals(openTag))
                {
                    names.add(getValue(goodInputs.get(index), j));
                }
                i++;
                j = i + openTag.length() - 1;
            }
        }
        return names;
    }
   
    public static String getValue(String line, int tagIndex)
    {
        String value = "";
        for(int i = tagIndex + 1; i < line.length(); i++)
        {
            if(line.charAt(i) == '<')
            {
                value += line.substring(tagIndex + 1, i);
                break;
            }
        }
        return value;
    }
   
}

ThienDinh
Admin

Posts : 27
Join date : 2012-11-30

https://computerscienceqc.board-directory.net

Back to top Go down

Program checking faculty absent list Empty Re: Program checking faculty absent list

Post by Petahwil Fri Nov 30, 2012 10:52 pm

Sooo sick that this works!! No more going on the stupid school website!! XD

Petahwil

Posts : 8
Join date : 2012-11-30
Age : 31

Back to top Go down

Program checking faculty absent list Empty Re: Program checking faculty absent list

Post by ThienDinh Fri Nov 30, 2012 11:08 pm

clown clown clown clown clown clown clown clown clown

ThienDinh
Admin

Posts : 27
Join date : 2012-11-30

https://computerscienceqc.board-directory.net

Back to top Go down

Program checking faculty absent list Empty Re: Program checking faculty absent list

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum