Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 5th, 2004, 01:27 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default This program has stumped me, help! :)

Hey guys, I was trying to help my friend create this textpad java program and I am completely stumped. Can someone get this to work please?

Your program should ask the name of the file to be taken as an
input for reading.
Your program then should read the file and produces the following
output as follow:

Number of vowels in in this file is: (print the number of vowels)
Number of a's is: (print the number of a's)
Number of e's is: (print the number of e's)
Number of i's is: (print the number of i's)
Number of o's is: (print the number of o's)
Number of u's is: (print the number of u's)

The Number of lines in this file is: (print the number of lines)

The Number of words in this file is: (Print the Number of words)

Your program should further print the above summary
in the form of a histogram as follows:

You program should have a separate class that constructs and prints
the histogram

Words : *********************

Lines : ***

Vowels : **********************

a's : ********

e's : ****

i's : *****

o's : ***

u's : **

Try Printing the above histogram vertical.

 
Old December 5th, 2004, 01:31 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

import java.io.*;
public class FileInput
{
    public static void main(String args[]) throws IOException
    {
        BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
        String nameOfFile;
        System.out.print("\nName of the file to read from: ");
        nameOfFile=input.readLine(); //program knows what file to read from
        BufferedReader inFile=new BufferedReader(new FileReader(nameOfFile));

        String lineOne; int lineNo=1;
        while((lineOne=inFile.readLine()) != null)//read the first line into lineOne
        {
            if(lineNo==3)
            {
                System.out.println(lineOne);
                break;
            }
            lineNo+=1;
            System.out.println("line number now is: "+lineNo);
        }//end of while lineOne
        inFile.close(); //closes the file
    }//end of main
}



I was able to get this far, but I can't figure out the rest.






Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm stumped MadMutant BOOK: Beginning Access 2007 VBA ISBN: 978-0-470-04684-5 1 July 24th, 2008 05:29 PM
Stumped on XSLT template hayedid XSLT 8 December 19th, 2007 02:14 PM
Completely Stumped Admiral1701 Classic ASP Professional 6 December 5th, 2006 02:35 PM
Stumped, need XSLT Help foobar XSLT 3 July 3rd, 2006 11:07 AM
Stumped: Contains() Method Woes kwilliams XSLT 5 January 19th, 2006 06:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.