Please help with common program!!

First I want to say that I did search to forum and I have not found a roman numeral conversion program written with a user defined class. Im not good with the terminology but the two programs are "working together" however I cannot get the output to print properly.......so maybe they arent working together. Anyway here is my code for the two and the output I am getting. The program is to convert a roman numeral to an integer value.
   public class Roman
       public static int numeralToInt(char ch)
         switch(ch)
            case 'M':
               return 1000;
            case 'D':
               return 500;
            case 'C':
               return 100;
            case 'L':
               return 50;
            case 'X':
               return 10;
            case 'V':
               return 5;
            case 'I':
               return 1;
            case '0':
               return 0;
         return 0;
import java.util.*;
   import javax.swing.JOptionPane;
   import java.io.*;
   import javax.swing.*;
    public class RomanMain extends Roman
      static Scanner console =new Scanner(System.in);
       public static void main(String[]args)
                          throws FileNotFoundException, InputMismatchException
         Roman r=new Roman();
         System.out.println("Please enter a Roman Numeral for Conversion");
         console.next();   
         System.out.println("The converted value is:"+r);
   }This is very basic, all I am trying to do right now is get the correct output. I have tested it just by using M which should equal 1000. However I get the following.
The converted value is:[email protected] in advance
Robert

Im not even gonna respond to your question db. I go to class 15 hours a week work 40 and spend another 20 studying for my OOP class and writing code, as well ascountless hours on my other homework. I work my ass off and when I get hung up I come here and read API's and browse forums archives looking for answers and when all else fails I come to the forums and ask. I've learned through surfing all these forums that most of you are assholes and have no interest in helping people. In fact most of you come off as thought the only reason you are here is cuase your self proclaimed java experts and you want all us newbies to bow down to you. I do appreciate everyone here that is not an asshole for helping, but anyone else that is just a total fuckwad can piss off. DB next time try asking a question without accusing someone of copying code.
Once again thanks to everyone that is polite about helping people. Im sure i violated teh code of conduct but if i dont get kicked out of here for good, when i get better at java I'm gonna devote time to helping students and not being a dickhead. Until then Adios I'm off to a forum that is helpful and not demeaning.
Robert

Similar Messages

  • Can anyone please help with my program?

    I know, I know. It's another Mortgage Calculator question. I'm sure you all are sick of them. But I don't know where else to turn, our instructor is not helpful at all and never even bothers to respond to our questions.
    Anyway so the assignment is:
    Write the program in Java (with a graphical user interface) so that it will allow the user to select which way they want to calculate a mortgage: by input of the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage payment or by input of the amount of a mortgage and then select from a menu of mortgage loans:
    - 7 year at 5.35%
    - 15 year at 5.5 %
    - 30 year at 5.75%
    In either case, display the mortgage payment amount and then, list the loan balance and interest paid for each payment over the term of the loan. Allow the user to loop back and enter a new amount and make a new selection, or quit. Insert comments in the program to document the program.
    Here is what I have so far:
    import java.text.*;
    import java.math.*;
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    public class MortgageCalcv7 extends javax.swing.JFrame
        //new form creation
             public MortgageCalcv7()
                    initComponents();
                    setLocation(400,250);
        // New method to initialize the form
        private void initComponents()// starts the java components initialization
            amtofloan = new javax.swing.JLabel();
            text1 = new javax.swing.JTextField();
            term = new javax.swing.JLabel();
            radiobutt1 = new javax.swing.JRadioButton();
            radiobutt2 = new javax.swing.JRadioButton();
            radiobutt3 = new javax.swing.JRadioButton();
            calculatebutt1 = new javax.swing.JButton();
            amt1 = new javax.swing.JLabel();
            panescroll = new javax.swing.JScrollPane();
            textarea1 = new javax.swing.JTextArea();
            quitbutt1 = new javax.swing.JButton();
            clearbutton = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("McBride Financial Services Mortgage Calculator"); //displays title bar text
            amtofloan.setText("Enter the dollar amount of your Mortgage:"); // text area title for where user puts dollar amount of mortgage
            term.setText("Select Your Term and Interest Rate:"); // text area title for where user puts in term and interest rate selection
            radiobutt1.setText("7 years at 5.35% interest"); // sets button text for first radio button
            radiobutt1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); // sets border for radiobutt1
            radiobutt1.setMargin(new java.awt.Insets(0, 0, 0, 0)); // sets margin for radiobutt1
            radiobutt1.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(java.awt.event.ActionEvent e) // class for action event
                    radiobutt1ActionPerformed(e);
            radiobutt2.setText("15 years at 5.5% interest");// sets button text for second radio button
            radiobutt2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); // sets border for radiobutt2
            radiobutt2.setMargin(new java.awt.Insets(0, 0, 0, 0)); // sets margin for radiobutt2
            radiobutt2.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(java.awt.event.ActionEvent e) // class for action event
                    radiobutt2ActionPerformed(e);
            radiobutt3.setText("30 years at 5.75% interest");// sets button text for third and final radio button
            radiobutt3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));// sets border for radiobutt3
            radiobutt3.setMargin(new java.awt.Insets(0, 0, 0, 0));// sets margin for radiobutt3
            radiobutt3.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(java.awt.event.ActionEvent e)// class for action event
                    radiobutt3ActionPerformed(e);
            calculatebutt1.setText("Submit"); // submit button text
            calculatebutt1.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(java.awt.event.ActionEvent e)
                    calculatebutt1ActionPerformed(e);
              // sets text area size
            textarea1.setColumns(20);
            textarea1.setEditable(false);
            textarea1.setRows(5);
            panescroll.setViewportView(textarea1);
            quitbutt1.setText("Quit"); // quit button text
            quitbutt1.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(java.awt.event.ActionEvent e)
                    quitbutt1ActionPerformed(e);
         //layout
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(26, 26, 26)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(panescroll, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(amt1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 222, Short.MAX_VALUE)
                                .addComponent(calculatebutt1)
                                .addGap(75, 75, 75))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(radiobutt3)
                                    .addComponent(radiobutt2)
                                    .addComponent(radiobutt1)
                                    .addComponent(term)
                                    .addComponent(amtofloan)
                                    .addComponent(text1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addContainerGap(224, Short.MAX_VALUE)))))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(277, Short.MAX_VALUE)
                    .addComponent(quitbutt1)
                    .addGap(70, 70, 70))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(31, 31, 31)
                    .addComponent(amtofloan)
                    .addGap(14, 14, 14)
                    .addComponent(text1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(20, 20, 20)
                    .addComponent(term)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(radiobutt1)
                    .addGap(15, 15, 15)
                    .addComponent(radiobutt2)
                    .addGap(19, 19, 19)
                    .addComponent(radiobutt3)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(calculatebutt1)
                        .addComponent(amt1))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(panescroll, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
                    .addGap(18, 18, 18)
                    .addComponent(quitbutt1)
                    .addGap(20, 20, 20))
            pack();
        } // Ends java components initialization
        private void quitbutt1ActionPerformed(java.awt.event.ActionEvent e)
        {// starts event_quitbutt1ActionPerformed
            System.exit(1);
        }// starts event_quitbutt1ActionPerformed
        static NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
        static NumberFormat np = NumberFormat.getPercentInstance();
        static NumberFormat ni = NumberFormat.getIntegerInstance();
        static BufferedReader br;
        private void calculatebutt1ActionPerformed(java.awt.event.ActionEvent e)
        { // starts event_calculatebutt1ActionPerformed
        public void actionToBePerformed(ActionEvent e)
         if ("Clear". equals(e.getActionCommand())
         calculatePayment();
         else if
         amtofloan.settext("");
         intrst.settext("");
         loanspan.settext("");
         monthlypayments.settext("");
         rate.settext("");
         term.settext("")
         intRate=Integer.parseInt(Rate.showtext());
         DecimalFormat money = new DecimalFormat("$0.00");
            amt1.setText(null);
            textarea1.setText(null);
            double pmntamt;
            double intrst;
            double amounnt1;
            int loanspan;
            double interestmonthly, principlemonthly, balanceofloan;
            int balanceremainder, amtoflines;
            np.setMinimumFractionDigits(2);
        br = new BufferedReader(new InputStreamReader(System.in));
      amtoflines = 0;
            try
                    amounnt1=Double.parseDouble(text1.getText());
            catch (Exception evt)
                amt1.setText("Enter total amount due on mortgage");
                return;
            if(radiobutt1.isSelected())
                intrst=0.0535;
                loanspan=7;
            else if(radiobutt2.isSelected())
                intrst=0.055;
                loanspan=15;
            else if(radiobutt3.isSelected())
                intrst=0.0575;
                loanspan=30;
            else
                amt1.setText("Select term of loan and interest rate");
                return;
        textarea1.append(" For mortgage amount " + nf.format(amounnt1)+"\n"+" with mortgage term " + ni.format(loanspan) + " years"+"\n"+" and interest rate of " + np.format(intrst)+"\n"+" the monthly payment is " + nf.format(getMortgagePmt(amounnt1, loanspan, intrst))+"\n"+"\n");
        balanceofloan = amounnt1 - ((getMortgagePmt(amounnt1, loanspan, intrst)) - (amounnt1*(intrst/12)));
        balanceremainder = 0;
        do
            interestmonthly = balanceofloan * (intrst/12);// monthly interest
             principlemonthly = (getMortgagePmt(amounnt1, loanspan, intrst)) - interestmonthly;//*Principal payment each month minus interest
            balanceremainder = balanceremainder + 1;
            balanceofloan = balanceofloan - principlemonthly;//remaining balance
            textarea1.append(" Principal on payment  " + ni.format(balanceremainder) + " is " + nf.format(principlemonthly)+"\n");
                    textarea1.append(" Interest on payment  " + ni.format(balanceremainder) + " is " + nf.format(interestmonthly)+"\n");
                    textarea1.append(" Remaining balance on payment  " + ni.format(balanceremainder) + " is " + nf.format(balanceofloan)+"\n"+"\n"+"\n");
         while (balanceofloan > 1);
        }// starts event_jRadioBtton1Action Performed
        public static double getMortgagePmt(double balance, double term, double rate)
                double monthlyRate = rate / 12;
                double pmntamt = (balance * monthlyRate)/(1-Math.pow(1+monthlyRate, - term * 12));
                return pmntamt;
        private void radiobutt3ActionPerformed(java.awt.event.ActionEvent e)
        {// starts event_radiobutt3ActionPerformed
             if(radiobutt2.isSelected())
                radiobutt2.setSelected(false);
             if(radiobutt1.isSelected())
                radiobutt1.setSelected(false);
        }// ends event_radiobutt3ActionPerformed
        private void radiobutt2ActionPerformed(java.awt.event.ActionEvent e)
        {// starts event_radiobutt2ActionPerformed
             if(radiobutt1.isSelected())
                radiobutt1.setSelected(false);
             if(radiobutt3.isSelected())
                radiobutt3.setSelected(false);
        }// ends event_radiobutt2ActionPerformed
        private void radiobutt1ActionPerformed(java.awt.event.ActionEvent e)
        {// starts event_radiobutt1ActionPerformed
            if(radiobutt2.isSelected())
                radiobutt2.setSelected(false);
            if(radiobutt3.isSelected())
                radiobutt3.setSelected(false);
        }// ends event_radiobutt1ActionPerformed
        public static void main(String args[]) //main method start
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    new MortgageCalcv7().setVisible(true);
        // declares variables
        private javax.swing.JButton calculatebutt1;
        private javax.swing.JButton quitbutt1;
        private javax.swing.JButton clearbutton;
        private javax.swing.JLabel amtofloan;
        private javax.swing.JLabel term;
        private javax.swing.JLabel amt1;
        private javax.swing.JRadioButton radiobutt1;
        private javax.swing.JRadioButton radiobutt2;
        private javax.swing.JRadioButton radiobutt3;
        private javax.swing.JScrollPane panescroll;
        private javax.swing.JTextArea textarea1;
        private javax.swing.JTextField text1;
    } //end MortgageCalcv7.javaEverything was fine until I tried to add the clear button. Now it won't compile and gives me the following errors. Please if you could find it in your kind heart to help a girl out, I would be forever in your debt. Thanks in advance!
    MortgageCalcv7.java:211: illegal start of expression
    public void actionToBePerformed(ActionEvent e)
    ^
    MortgageCalcv7.java:213: ')' expected
         if ("Clear". equals(e.getActionCommand())
         ^
    MortgageCalcv7.java:218: '(' expected
         else if
         ^
    MortgageCalcv7.java:219: illegal start of expression
         ^
    MortgageCalcv7.java:225: ';' expected
         term.settext("")
         ^
    MortgageCalcv7.java:291: illegal start of expression
    public static double getMortgagePmt(double balance, double term, double rate)
    ^
    6 errors
    Edited by: cheesegoddess on Oct 12, 2008 7:49 AM

    You guys were very helpful, thank you! Thank you so very much!! The others needed braces somewhere and I took else out and that line compiles now. Thank you, thank you, thank you.
    I am down to 1 error now. I cannot find where there is a missing bracket, if that is the problem.
    The line erring is:
    211    public void actionToBePerformed(ActionEvent e)and the error I am still getting is:
    MortgageCalcv7.java:211: illegal start of expression
    public void actionToBePerformed(ActionEvent e)
    ^
    Any ideas? TIA.

  • Please help with Java program

    Errors driving me crazy! although compiles fine
    I am working on a project for an online class - I am teaching myself really! My last assignment I cannot get to work. I had a friend who "knows" what he is doing help me. Well that didn't work out too well, my class is a beginner and he put stuff in that I never used yet. I am using Jgrasp and Eclipse. I really am trying but, there really is no teacher with this online class. I can't get questions answered in time and stuff goes past due. I am getting this error:
    Exception in thread "main" java.lang.NullPointerException
    at java.io.Reader.<init>(Reader.java:61)
    at java.io.InputStreamReader.<init>(InputStreamReader .java:55)
    at java.util.Scanner.<init>(Scanner.java:590)
    at ttest.main(ttest.java:54)
    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.
    This is my code:
    import java.util.*;
    import java.io.*;
    public class ttest
    static Scanner console = new Scanner(System.in);
    public static void main(String[] args)throws IOException
    FileInputStream fin = null; // input file reference
    PrintStream floser = null; // output file references
    PrintStream fwinner = null;
    Scanner rs; // record scanner
    Scanner ls; // line scanner
    String inputrec; // full record buffer
    int wins; // data read from each record
    int losses;
    double pctg;
    String team;
    String best = null; // track best/worst team(s)
    String worst = null;
    double worst_pctg = 2.0; // track best/worst pctgs
    double best_pctg = -1.0;
    int winner_count = 0; // counters for winning/losing records
    int loser_count = 0;
    // should check args.length and if not == 1 generate error
    try
    Scanner inFile = new Scanner(new FileReader("football.txt"));
    catch( FileNotFoundException e )
    System.exit( 1 );
    try
    floser = new PrintStream( new FileOutputStream( "loser.txt" ) );
    fwinner = new PrintStream( new FileOutputStream( "winner.txt" ) );
    catch( FileNotFoundException e )
    System.out.printf( "unable to open an output file: %s\n", e.toString() );
    System.exit( 1 );
    try
    rs = new Scanner( fin );
    while( rs.hasNext( ) )
    inputrec = rs.nextLine( ); /* read next line */
    ls = new Scanner( inputrec ); /* prevents stumble if record has more than expected */
    team = ls.next( );
    wins = ls.nextInt();
    losses = ls.nextInt();
    if( wins + losses > 0 )
    pctg = ((double) wins)/(wins + losses);
    else
    pctg = 0.0;
    if( pctg > .5 )
    if( pctg > best_pctg )
    best_pctg = pctg;
    best = team;
    else
    if( pctg == best_pctg )
    best += ", " + team;
    fwinner.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
    winner_count++;
    else
    if( pctg < worst_pctg )
    worst_pctg = pctg;
    worst = team;
    else
    if( pctg == worst_pctg )
    worst += ", " + team;
    floser.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
    loser_count++;
    fin.close( );
    floser.close( );
    fwinner.close( );
    catch( IOException e ) {
    System.out.printf( "I/O error: %s\n", e.toString() );
    System.exit( 1 );
    System.out.printf( "%d teams have winning records; %d teams have losing records\n", winner_count, loser_count );
    System.out.printf( "Team(s) with best percentage: %5.3f %s\n", best_pctg, best );
    System.out.printf( "Team(s) with worst percentage: %5.3f %s\n", worst_pctg, worst );
    The assignment is:
    Create a Java program to read in an unknown number of lines from a data file. You will need to create the data file. The contents of the file can be found at the bottom of this document. This file contains a football team's name, the number of games they have won, and the number of games they have lost.
    Your program should accomplish the following tasks:
    1. Process all data until it reaches the end-of-file. Calculate the win percentage for each team.
    2. Output to a file ("top.txt") a listing of all teams with a win percentage greater than .500. This file should contain the team name and the win percentage.
    3. Output to a file ("bottom.txt") a listing of all teams with a win percentage of .500 or lower. This file should contain the team name and the win percentage.
    4. Count and print to the screen the number of teams with a record greater then .500 and the number of teams with a record of .500 and below, each appropriately labeled.
    5. Output in a message box: the team with the highest win percentage and the team with the lowest win percentage, each appropriately labeled. If there is a tie for the highest win percentage or a tie for the lowest win percentage, you must output all of the teams.
    Dallas 5 2
    Philadelphia 4 3
    Washington 3 4
    NY_Giants 3 4
    Minnesota 6 1
    Green_Bay 3 4

    import java.util.*;
    import java.io.*;
    public class ttest
    static Scanner console = new Scanner(System.in);
    public static void main(String[] args)throws IOException
    FileInputStream fin = null; // input file reference
    PrintStream floser = null; // output file references
    PrintStream fwinner = null;
    Scanner rs; // record scanner
    Scanner ls; // line scanner
    String inputrec; // full record buffer
    int wins; // data read from each record
    int losses;
    double pctg;
    String team;
    String best = null; // track best/worst team(s)
    String worst = null;
    double worst_pctg = 2.0; // track best/worst pctgs
    double best_pctg = -1.0;
    int winner_count = 0; // counters for winning/losing records
    int loser_count = 0;
    // should check args.length and if not == 1 generate error
    try
    Scanner inFile = new Scanner(new FileReader("football.txt"));
    catch( FileNotFoundException e )
    System.exit( 1 );
    try
    floser = new PrintStream( new FileOutputStream( "loser.txt" ) );
    fwinner = new PrintStream( new FileOutputStream( "winner.txt" ) );
    catch( FileNotFoundException e )
    System.out.printf( "unable to open an output file: %s\n", e.toString() );
    System.exit( 1 );
    try
    rs = new Scanner( fin );
    while( rs.hasNext( ) )
    inputrec = rs.nextLine( ); /* read next line */
    ls = new Scanner( inputrec ); /* prevents stumble if record has more than expected */
    team = ls.next( );
    wins = ls.nextInt();
    losses = ls.nextInt();
    if( wins + losses > 0 )
    pctg = ((double) wins)/(wins + losses);
    else
    pctg = 0.0;
    if( pctg > .5 )
    if( pctg > best_pctg )
    best_pctg = pctg;
    best = team;
    else
    if( pctg == best_pctg )
    best += ", " + team;
    fwinner.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
    winner_count++;
    else
    if( pctg < worst_pctg )
    worst_pctg = pctg;
    worst = team;
    else
    if( pctg == worst_pctg )
    worst += ", " + team;
    floser.printf( "%10s %2d %2d %5.3f\n", team, wins, losses, pctg );
    loser_count++;
    fin.close( );
    floser.close( );
    fwinner.close( );
    catch( IOException e ) {
    System.out.printf( "I/O error: %s\n", e.toString() );
    System.exit( 1 );
    System.out.printf( "%d teams have winning records; %d teams have losing records\n", winner_count, loser_count );
    System.out.printf( "Team(s) with best percentage: %5.3f %s\n", best_pctg, best );
    System.out.printf( "Team(s) with worst percentage: %5.3f %s\n", worst_pctg, worst );
    }

  • Please help with my program

    I'm a newbie, i wrote a simple dictanary program, but i can't make it run properly. there are no errors but there is a problem...
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.regex.*;
    public class Dictionary{
    public static void main(String args[]){
    DicWin dic = new DicWin("Dictionary");
    class DicWin extends Frame implements ActionListener{
    Panel[] panels = new Panel[2];
    private static String REGEX = "^";
    Button ok;
    TextField text;
    String[] words;
    TextArea textF;
    public DicWin(String title){
         super(title);
         ReadDic("Mueller24.txt");
         setLayout(new GridLayout(2,1));
         panels[0] = new Panel();
         panels[1] = new Panel();
         First(panels[0]);
         Second(panels[1]);
         add(panels[0]);
         add(panels[1]);
         pack();
         setVisible(true);
    public void First(Container con){
         ok = new Button("OK");
         text = new TextField(20);
         con.add(ok);
         ok.addActionListener(this);
         con.add(text);
    public void Second(Container con){
         textF = new TextArea(5,20);
         con.add(textF);
    public void actionPerformed(ActionEvent e)
    String text2 = text.getText();
    Pattern p = Pattern.compile(REGEX + text2);
    for(int j=0;j<words.length;j++){
    Matcher m = p.matcher(words[j]);
    if(m.find())
         textF.setText(textF.getText() + "\n" + words[j]);
    private void ReadDic (String FileName){
    String line;
    int i=0;
    BufferedReader in = null;
    try{
    in = new BufferedReader(new FileReader("Mueller24.txt"));
         while((line = in.readLine())!=null)
         i++;
         words = new String;
         i=0;
         while((line = in.readLine())!=null)
         words[i]=line;
         i++;
    catch(IOException e){
    System.out.println("Error Loading the file.");

    Please make the ReadDic() method as following.
    private void ReadDic(String FileName) {
    String line;
    int i = 0;
    BufferedReader in = null;
    try {
    in = new BufferedReader(new FileReader("Mueller24.txt"));
    while ((line = in.readLine()) != null) {
    i++;
    words = new String[10];
    i = 0;
    while ((line = in.readLine()) != null) {
    words[i] = line;
    i++;
    } catch (IOException e) {
    System.out.println("Error Loading the file.");
    Please notice the line
    words = new String;
    in your original program should be something like following,
    words = new String[10]
    and the line,
    words = line;
    should be
    words[i] = line;
    I hope this would help.
    Pramoda

  • Help with a Program I am writing!  Please!

    Hello All,
    This is my first post...I hope to find some answers to my program I am writing! A couple things first - I am 17, and have designed a comp. science class for myself to take while a senior in high school, since there was not one offered. My end of the 2nd term project is to write a program that encompasses the information I have learned about for the past two terms. I know the very basics, if that. Please help!
    My program involves the simple dice throwing program, 'Dice Thrower' by Kevin Boone. The full text/program write out can be found at:
    http://www.kevinboone.com/PF_DiceThrower-java.html
    I am hoping to add a part to this program that basically tells the program if the dice show doubles, pop up a little GUI window that says "You are a Winner! You Got Doubles!"
    I was thinking as I finished chapter 7 in my text book, that either an 'if/else' or 'switch' statement might be the right place to start.
    Could someone please write me a start to the program text that I need to add to 'Dice Thrower', or explain what I need to do to get started! Thank you so much, I really appreciate it.
    Erick DeVore - Eroved Kcire

    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JLabel;
    import javax.swing.JFrame;
    import java.awt.FlowLayout;
    import java.awt.Color;
    public class DiceThrower extends Applet
    Die die1;
    Die die2;
    public void paint (Graphics g)
         die1.draw(g);
         die2.draw(g);
         g.drawString ("Click mouse anywhere", 55, 140);
         g.drawString ("to throw dice again", 65, 160);
    public void init()
         die1 = new Die();
         die2 = new Die();
         die1.setTopLeftPosition(20, 20);
         die2.setTopLeftPosition(150, 20);
         throwBothDice();
         // Erick's Program Insert below
         public class WinnerGui extends JFrame;
      public WinnerGui();
        super ("You Are The Winner with GUI");
        Container c = getContentPane();
        c.setBackground(Color.lightGray);
        c.setLayout(new FlowLayout());
        c.add(new JLabel("You're a Winner! You Got Doubles!"));
            //End Erick's Program insert
         DiceThrowerMouseListener diceThrowerMouseListener =
              new DiceThrowerMouseListener();
         diceThrowerMouseListener.setDiceThrower(this);
         addMouseListener(diceThrowerMouseListener);
    public void throwBothDice();
         die1.throwDie();
         die2.throwDie();
         repaint();
    class Die
    int topLeftX;
    int topLeftY;
    int numberShowing = 6;
    final int spotPositionsX[] = {0, 60,  0, 30, 60,  0,  60};
    final int spotPositionsY[] = {0,  0, 30, 30, 30,  60, 60};
    public void setTopLeftPosition(final int _topLeftX, final int _topLeftY)
         topLeftX = _topLeftX;
         topLeftY = _topLeftY;
    public void throwDie()
         numberShowing = (int)(Math.random() * 6 + 1);
    public void draw(Graphics g)
         switch(numberShowing)
              case 1:
                   drawSpot(g, 3);
                   break;
              case 2:
                   drawSpot(g, 0);
                   drawSpot(g, 6);
                   break;
              case 3:
                   drawSpot(g, 0);
                   drawSpot(g, 3);
                   drawSpot(g, 6);
                   break;
              case 4:
                   drawSpot(g, 0);
                   drawSpot(g, 1);
                   drawSpot(g, 5);
                   drawSpot(g, 6);
                   break;
              case 5:
                   drawSpot(g, 0);
                   drawSpot(g, 1);
                   drawSpot(g, 3);
                   drawSpot(g, 5);
                   drawSpot(g, 6);
                   break;
              case 6:
                   drawSpot(g, 0);
                   drawSpot(g, 1);
                   drawSpot(g, 2);
                   drawSpot(g, 4);
                   drawSpot(g, 5);
                   drawSpot(g, 6);
                   break;
    void drawSpot(Graphics g, final int spotNumber)
         g.fillOval(topLeftX + spotPositionsX[spotNumber],
              topLeftY + spotPositionsY[spotNumber], 20, 20);
    class DiceThrowerMouseListener extends MouseAdapter
    DiceThrower diceThrower;
    public void mouseClicked (MouseEvent e)
         diceThrower.throwBothDice();
    public void setDiceThrower(DiceThrower _diceThrower)
         diceThrower = _diceThrower;
    }That was what I have dwindled it down to, using my knowledge, as well as others' expertise...however I am listening to what you say, and get these messages when I try to compile in the CMD:
    line 63 - illegal start of expression (carrot at p in public)
    line 63 - ; expected (carrot at c in class)
    line 63 - { expected (carrot at ; at end of line)
    line 65 - illegal start of expression (carrot at p in public)
    line 83 - <identifier> expected (carrot as: (this) ) -- I don't even know what that means ^
    line 84 - invalid method declaration; return type required (carrot at a in add)
    line 84 - <identifier> expected (carrot like this: [see below])
    addMouseListener(diceThrowerMouseListener);
    ^
    line 84 - ) expected (carrot is one place over from previous spot [see above]
    line 93 - illegal start of expression (carrot at p in public)
    I know this seems like a lot of errors, but believe it or not, I actually had it up in the high teens and was able to fix some of them myself from going by previous examples, as well as looking things up in my text book. If anyone has any suggestions concerning the syntax errors of the code, please please let me know and I will work my hardest to fix them...thank you all so much for helping.
    Erick

  • Welcome. At the outset, I'm sorry for my English :) Please help with configuration Photoshop CS6 appearance. How to disable the background of the program so you can see the desktop. (same menus and tools) Chiałbym to be the same effect as CS5.

    Welcome.
    At the outset, I'm sorry for my English
    Please help with configuration Photoshop CS6 appearance.
    How to disable the background of the program so you can see the desktop. (same menus and tools)
    i wantto be the same effect as CS5.

    Please try turning off
    Window > Application Frame

  • Help with Paint program.

    Hello. I am somewhat new to Java and I was recently assigned to do a simple paint program. I have had no trouble up until my class started getting into the graphical functions of Java. I need help with my program. I am supposed to start off with a program that draws lines and changes a minimum of 5 colors. I have the line function done but my color change boxes do not work and I am able to draw inside the box that is supposed to be reserved for color buttons. Here is my code so far:
    // Lab13110.java
    // The Lab13 program assignment is open ended.
    // There is no provided student version for starting, nor are there
    // any files with solutions for the different point versions.
    // Check the Lab assignment document for additional details.
    import java.applet.Applet;
    import java.awt.*;
    public class Lab13110 extends Applet
         int[] startX,startY,endX,endY;
         int currentStartX,currentStartY,currentEndX,currentEndY;
         int lineCount;
         Rectangle red, green, blue, yellow, black;
         int numColor;
         Image virtualMem;
         Graphics gBuffer;
         int rectheight,rectwidth;
         public void init()
              startX = new int[100];
              startY = new int[100];
              endX = new int[100];
              endY = new int[100];
              lineCount = 0;
              red = new Rectangle(50,100,25,25);
              green = new Rectangle(50,125,25,25);
              blue = new Rectangle(50,150,25,25);
              yellow = new Rectangle(25,112,25,25);
              black = new Rectangle(25,137,25,25);
              numColor = 0;
              virtualMem = createImage(100,600);
              gBuffer = virtualMem.getGraphics();
              gBuffer.drawRect(0,0,100,600);
         public void paint(Graphics g)
              for (int k = 0; k < lineCount; k++)
                   g.drawLine(startX[k],startY[k],endX[k],endY[k]);
              g.drawLine(currentStartX,currentStartY,currentEndX,currentEndY);
              g.setColor(Color.red);
              g.fillRect(50,100,25,25);
              g.setColor(Color.green);
              g.fillRect(50,125,25,25);
              g.setColor(Color.blue);
              g.fillRect(50,150,25,25);
              g.setColor(Color.yellow);
              g.fillRect(25,112,25,25);
              g.setColor(Color.black);
              g.fillRect(25,137,25,25);
              switch (numColor)
                   case 1:
                        g.setColor(Color.red);
                        break;
                   case 2:
                        g.setColor(Color.green);
                        break;
                   case 3:
                        g.setColor(Color.blue);
                        break;
                   case 4:
                        g.setColor(Color.yellow);
                        break;
                   case 5:
                        g.setColor(Color.black);
                        break;
                   case 6:
                        g.setColor(Color.black);
                        break;
              g.setColor(Color.black);
              g.drawRect(0,0,100,575);
         public boolean mouseDown(Event e, int x, int y)
              currentStartX = x;
              currentStartY = y;
              if(red.inside(x,y))
                   numColor = 1;
              else if(green.inside(x,y))
                   numColor = 2;
              else if(blue.inside(x,y))
                   numColor = 3;
              else if(yellow.inside(x,y))
                   numColor = 4;
              else if(black.inside(x,y))
                   numColor = 5;
              else
                   numColor = 6;
              repaint();
              return true;
         public boolean mouseDrag(Event e, int x, int y)
              int Rectheight = 500;
              int Rectwidth = 900;
              currentEndX = x;
              currentEndY = y;
              Rectangle window = new Rectangle(0,0,900,500);
              //if (window.inside(Rectheight,Rectwidth))
                   repaint();
              return true;
         public boolean mouseUp(Event e, int x, int y)
              int Rectheight = 500;
              int Rectwidth = 900;
              startX[lineCount] = currentStartX;
              startY[lineCount] = currentStartY;
              endX[lineCount] = x;
              endY[lineCount] = y;
              lineCount++;
              Rectangle window = new Rectangle(0,0,900,500);
              if (window.inside(Rectheight,Rectwidth))
                   repaint();
              return true;
         public void Rectangle(Graphics g, int x, int y)
              g.setColor(Color.white);
              Rectangle screen = new Rectangle(100,0,900,600);
    }If anyone could point me in the right direction of how to go about getting my buttons to work and fixing the button box, I would be greatly appreciative. I just need to get a little bit of advice and I think I should be good after I get this going.
    Thanks.

    This isn't in any way a complete solution, but I'm posting code for a mouse drag outliner. This may be preferable to how you are doing rectangles right now
    you are welcome to use and modify this code but please do not change the package and make sure that you tell your teacher where you got it from
    MouseDragOutliner.java
    package tjacobs.ui;
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.Stroke;
    import java.awt.event.*;
    import java.util.ArrayList;
    import java.util.Iterator;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    * See the public static method addAMouseDragOutliner
    public class MouseDragOutliner extends MouseAdapter implements MouseMotionListener {
         public static final BasicStroke DASH_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 10.0f, new float[] {8, 8}, 0);
         private boolean mUseMove = false;
         private Point mStart;
         private Point mEnd;
         private Component mComponent;
         private MyRunnable mRunner= new MyRunnable();
         private ArrayList mListeners = new ArrayList(1);
         public MouseDragOutliner() {
              super();
         public MouseDragOutliner(boolean useMove) {
              this();
              mUseMove = useMove;
         public void mouseDragged(MouseEvent me) {
              doMouseDragged(me);
         public void mousePressed(MouseEvent me) {
              mStart = me.getPoint();
         public void mouseEntered(MouseEvent me) {
              mStart = me.getPoint();
         public void mouseReleased(MouseEvent me) {
              Iterator i = mListeners.iterator();
              Point end = me.getPoint();
              while (i.hasNext()) {
                   ((OutlineListener)i.next()).mouseDragEnded(mStart, end);
              //mStart = null;
         public void mouseMoved(MouseEvent me) {
              if (mUseMove) {
                   doMouseDragged(me);
         public     void addOutlineListener(OutlineListener ol) {
              mListeners.add(ol);
         public void removeOutlineListener(OutlineListener ol) {
              mListeners.remove(ol);
         private class MyRunnable implements Runnable {
              public void run() {
                   Graphics g = mComponent.getGraphics();
                   if (g == null) {
                        return;
                   Graphics2D g2 = (Graphics2D) g;
                   Stroke s = g2.getStroke();
                   g2.setStroke(DASH_STROKE);
                   int x = Math.min(mStart.x, mEnd.x);
                   int y = Math.min(mStart.y, mEnd.y);
                   int w = Math.abs(mEnd.x - mStart.x);
                   int h = Math.abs(mEnd.y - mStart.y);
                   g2.setXORMode(Color.WHITE);
                   g2.drawRect(x, y, w, h);
                   g2.setStroke(s);
         public void doMouseDragged(MouseEvent me) {
              mEnd = me.getPoint();
              if (mStart != null) {
                   mComponent = me.getComponent();
                   mComponent.repaint();
                   SwingUtilities.invokeLater(mRunner);
         public static MouseDragOutliner addAMouseDragOutliner(Component c) {
              MouseDragOutliner mdo = new MouseDragOutliner();
              c.addMouseListener(mdo);
              c.addMouseMotionListener(mdo);
              return mdo;
         public static interface OutlineListener {
              public void mouseDragEnded(Point start, Point finish);
         public static void main(String[] args) {
              JFrame f = new JFrame("MouseDragOutliner Test");
              Container c = f.getContentPane();
              JPanel p = new JPanel();
              //p.setBackground(Color.BLACK);
              c.add(p);
              addAMouseDragOutliner(p);
              f.setBounds(200, 200, 400, 400);
              f.addWindowListener(new WindowClosingActions.Exit());
              f.setVisible(true);
    }

  • Please help with homework :( I would REALLY appreicate it

    . Write a Java program to calculate and print a bill of sale based on the following:
    The cashier must input in the amount of the item purchased.
    Calculate taxes (GST at 7%, PST at 8%) and total bill.
    Output the entire bill showing purchased price, taxes and total in an attractive format which includes a $ sign and with all values rounded and displaying two decimal places. Apply cursor control commands and colour.
    The cashier must then input the amount tendered.
    Output the change from the amount tendered in an attractive format rounded and displaying two decimal places. Apply cursor control commands and colour.
    please can anyone help with this program...

    . Write a Java program to calculate and print a bill
    of sale based on the following:
    The cashier must input in the amount of the item
    item purchased.
    Calculate taxes (GST at 7%, PST at 8%) and total
    l bill.
    Output the entire bill showing purchased price,
    , taxes and total in an attractive format which
    includes a $ sign and with all values rounded and
    displaying two decimal places. Apply cursor control
    commands and colour.
    The cashier must then input the amount tendered.
    Output the change from the amount tendered in an
    n attractive format rounded and displaying two
    decimal places. Apply cursor control commands and
    colour.
    please can anyone help with this program...Sir,
    As a shamed to admit fellow resident of your province I must tell you this is HIGHLY unimpressive. I know for example that we have just finished our long weekend for thanksgiving so you certainly had the time to complete this assignment.
    I hope you fail this one and it teaches you a valuable lesson about time management in the case of homework and your future v. screwing around on XBox.
    Sincerely,
    Slappy

  • Please help find the program

    Please help find the program to block unwanted number, call and SMS, that not all block number ,but  the number on which you want to.

    Which part of "The 5310 is just a java phone that cannot support applications like this." did you not understand?
    If you want to achieve any form of blocking at all, it won't be with that phone. Your operator may be able to help by putting a block in place on their end, though, but I doubt it.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • HT5824 I switched over from an iPhone to a Samsung Galaxy S3 & I haven't been able to receive any text messages from iPhones. Please help with turning my iMessage completely off..

    I switched over from an iPhone to a Samsung Galaxy S3 & I haven't been able to receive any text messages from iPhones. I have no problem sending the text messages but I'm not receivng any from iPhones at all. It has been about a week now that I'm having this problem. I've already tried fixing it myself and I also went into the sprint store, they tried everything as well. My last option was to contact Apple directly. Please help with turning my iMessage completely off so that I can receive my texts.

    If you registered your iPhone with Apple using a support profile, try going to https://supportprofile.apple.com/MySupportProfile.do and unregistering it.  Also, try changing the password associated with the Apple ID that you were using for iMessage.

  • How can I sync my iPhone on a different computer without erasing my applications? My iPhone was earlier synced with a PC which I don't use anymore. Please help with proper steps, if any.

    How can I sync my iPhone on a different computer without erasing my applications? My iPhone was earlier synced with a PC which I don't use anymore.
    On the new computer, I am getting a message that my all purchases would be deleted if I sync it with new iTunes library.
    Please help with proper steps, if any.

    Also see... these 2 Links...
    Recovering your iTunes library from your iPod or iOS device
    https://discussions.apple.com/docs/DOC-3991
    Syncing to a New Computer...
    https://discussions.apple.com/docs/DOC-3141

  • Please help with "You can't open the application NovamediaDiskSupressor because PowerPC applications are no longer supported." I have seen other responses on this but am not a techie and would not know how to start with that solution.

    Please help with the message I am receving on startup ""You can't open the application NovamediaDiskSupressor because PowerPC applications are no longer supported."
    I have read some of the replies in the Apple Support Communities, but as I am no techie, I would have no idea how I would implement that solution.
    Please help with what I need to type, how, where, etc.
    Many thanks
    AppleSueIn HunterCreek

    I am afraid there is no solution.
    PowerPC refers to the processing chip used by Apple before they transferred to Intel chips. They are very different, and applications written only for PPC Macs cannot work on a Mac running Lion.
    You could contact the developers to see if they have an updated version in the pipeline.

  • Online Help for Common Programs Will Not Open in Firefox

    Many of my programs, such as Ultradefrag and Audacity (to name two), present their Help guides and User Manuals using a browser. I have Firefox set as my default browser. Every time I try to use help with these programs, I get the very frustrating message "Firefox is already running, but ...". I cannot use help without killing firefox and losing all of my browsing sessions. There simply MUST be a way around this. I do not experience this major problem with Internet Explorer. I'm using Firefox 14.0.1 on Windows 7 SP1 64-bit.

    Hi,
    You can try creating a a [https://support.mozilla.org/en-US/kb/Managing-profiles new profile]. Once it has been created you can use the '''Default User''' (the current profile) profile for the regular browsing, and choose the newly created dummy profile for external programs that need it.
    [https://support.mozilla.org/en-US/kb/Profiles?s=profile&r=2&e=sph&as=s Profiles Howto]
    [https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles Profile Manager]
    [http://kb.mozillazine.org/Profile_folder_-_Firefox Profile Folder & Files]

  • Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be ab

    Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be able to download the srtony adobe.

    Adobe - Lightroom : For Macintosh
    Hal

  • [ETL]Could you please help with a problem accessing UML stereotype attributes ?

    Hi all,
    Could you please help with a problem accessing UML stereotype attributes and their values ?
    Here is the description :
    -I created a UML model with Papyrus tool and I applied MARTE profile to this UML model.
    -Then, I applied <<PaStep>> stereotype to an AcceptEventAction ( which is one of the element that I created in this model ), and set the extOpDemand property of the stereotype to 2.7 with Papyrus.
    -Now In the ETL file, I can find the stereotype property of extOpDemand as follows :
    s.attribute.selectOne(a|a.name="extOpDemand") , where s is a variable of type Stereotype.
    -However I can't access the value 2.7 of the extOpDemand attribute of the <<PaStep>> Stereotype. How do I do that ?
    Please help
    Thank you

    Hi Dimitris,
    Thank you , a minimal example is provided now.
    Version of the Epsilon that I am using is : ( Epsilon Core 1.2.0.201408251031 org.eclipse.epsilon.core.feature.feature.group Eclipse.org)
    Instructions for reproducing the problem :
    1-Run the uml2etl.etl transformation with the supplied launch configuration.
    2-Open lqn.model.
    There are two folders inside MinimalExample folder, the one which is called MinimalExample has 4 files, model.uml , lqn.model, uml2lqn.etl and MinimalExampleTransformation.launch.
    The other folder which is LQN has four files. (.project),LQN.emf,LQN.ecore and untitled.model which is an example model conforming to the LQN metamodel to see how the model looks like.
    Thank you
    Mana

Maybe you are looking for

  • Standard ALV Report default  print parameters

    Hi, We recently upgraded to ECC6. In some of the ALV reports for example F.35  (Credit Master Sheet) default print parameter has wider column specifications (X_65_255) as against earlier version (X_65_132). It might be due to flexibility in increasin

  • Problem with Fireworks pop up menu in DW

    (I already posted this on the DW forum, but it's also about FW, so may be someone here knows about this as well.) Hi, I am working on a page whose layout was created in Fireworks and transferred to DW. After I transferred the page to DW and created n

  • How to find out the manditary fields in an IDOC

    Hi, How to find out the manditary fields in an IDOC. For example MATMAS05 . For this 2 segments I want to find out the manditary fields. E1MARA E1MAKTM

  • New Field for Report

    Hellow Gurus, In a Sales Report i'm getting 2  Quantities for a particular interval Sales Qty and Warrnty Qty.. now my new Report requirnment is Moving Annual Toatal Wty (MAT) % i.e is User Enter value at selection JUNE 08 then MAT % = Wty July  07+

  • Systems Preferences Opens Automatically

    My Systems Preferences opens on start up every time. I've been to Login Items in Accounts and it's not there to remove. How can I stop it from opening automatically? Thanks.