A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • one year ago

Does anyone know Java here? I am stuck almost to the kingdom come.

  • This Question is Closed
  1. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    khan academy should help

  2. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    if not, code academy

  3. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Alright. But a little bit of live help would be great as well:)

  4. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    okay what do you need help with?

  5. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    writing a program that allocates a file in hard drive and regulates the lines in it.

  6. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    sorry, I only know basic coding... I'll tag someone

  7. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @ganeshie8

  8. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Write ReadZILLA a program that will read a file called message.txt that contains ten lines of text. The program should determine the total number of words in the text, the number of vowels in each line and the average number of words per line.

  9. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I am stuck with this question.

  10. Nnesha
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    ello! post your question here http://openstudy.com/study#/groups/Computer%20Science hm i think @e.mccormick , @wio or ganesh can help

  11. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    I know Java I can help you with this.

  12. Nnesha
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 1

    ^

  13. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Amazing!!!

  14. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    You lucked out haha. Ok so how are you expected to do this, did they tell you anything about the Java IO classes? Depending on how basic they want you to do it, I might end up giving you a more advanced solution than you're ready for, so you might not want to use BufferedReader right now for instance depending on what your class wants.

  15. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Yeah I am learning about IO exception, buffer reader etc

  16. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    ``` public static void main(String... args){ helpMe(); } ``` You can type code like that with three of these symbols above and below your code `

  17. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    Ok so specifically what do you need help with, or you can go ahead and post whatever code you might have or might think you need or whatever, let's dive in. Or if you're having trouble thinking up like "how do I make it identify words?" I can help with that too, so just whatever you need help with since there's a lot of ways this can go wrong I don't wanna like help with stuff you already know if you get me haha.

  18. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok

  19. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    import java.io.*; public class While { @SuppressWarnings("resource") public static void main(String[] args) throws IOException { String line; BufferedReader write; write= new BufferedReader(new FileReader("message.txt.docx")); line = write.readLine(); while(line != null) { System.out.println(line); line = write.readLine(); } }

  20. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    That's the base for my assignment

  21. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    import java.io.*; public class While { @SuppressWarnings("resource") public static void main(String[] args) throws IOException { String line; BufferedReader write; write= new BufferedReader(new FileReader("message.txt.docx")); line = write.readLine(); while(line != null) { System.out.println(line); line = write.readLine(); } } }

  22. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    I see, so they are giving this to you and you have to "find the bugs" or are you "just adding to it"?

  23. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Sorry for posting twice

  24. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I am modifying and adding bits by bits

  25. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Create message.txt in notepad. Write ten lines of text making sure to press enter at the end of each line. Using the problem solving process (IPO chart, menu planning, pseudo code for each menu option) analyze this problem. Design a solution — write java on paper for each method Be sure to properly indent and internally document the program (include comments).

  26. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    This is the full instruction

  27. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I finished writing the random ten lines and saved it as "message.txt."

  28. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    However I am slightly stuck as to "using the problem solving process" due to the plethora of options here.

  29. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    Hmmm well I don't know what "the problem solving process is" unfortunately, but I can already see you have some problems going on here. It sounds like they want you to systematically go through this to eliminate bugs.

  30. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I'll just stick with pseudo code on a different page .

  31. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    But the major problem here is modifying the base code to fill the expectations for this program.

  32. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    For instance, the name of the class is "While" which doesn't really make sense to me, similarly you have named your buffered reader strangely (why not call it 'read'?): ``` BufferedReader write; ``` Another awkward thing happening is in the next line: ``` write= new BufferedReader(new FileReader("message.txt.docx")); ``` Look at what you have in that string, .txt.docx seems to be quite strange? I am just noticing these few things but there are probably other strange things happening here as well.

  33. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Sorry I made it under a class already used previously to conform with the name rules. That's just out of the blue for my novice .

  34. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I might have to recompile the program from what it seems .

  35. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I'll give it my best shot.

  36. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    Ohhh ok, I am just trying to make sense of everything here since I am not on the same page as you yet haha. Alright cool, I'll be here to help out, if you can ask more precise questions I'll be able to give you a better answer.

  37. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks so much! Your name is such a counterclaim to who you are:)

  38. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So given that my program needs to allocate the file with the name "message.txt", as well as determine the number of words in the text, number of vowels in each line and average number of words each line

  39. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    It is necessary that I create a separate file with that specified name of "message.txt" which I already did with the following.

  40. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Computer science. Science of modern age. Without computers, World will face a doom. They facilitate our lives, as well as our data. Huge multibillion industry going nuts with computers. Make sure you all Know how to use computers.

  41. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Hence with the above the requirement of making "message.txt" is filled.

  42. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    the file is saved in my hard drive, which is to be extracted by Java via Eclipse...

  43. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    And hence after the Eclipse will determine the given aspects-number of words per line, number of vowels, and average number of words per line respectively .

  44. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    This is my reasoning for the assignment until now. Am I on the right track?

  45. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    organizing the structures with the program is hard..

  46. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    I see, sorry I was distracted by something and lost track let me catch up to where you are haha.

  47. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    No problem at all! You are more than generous in being here

  48. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You seem quite into physics and math lol

  49. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    As I said over and over the instruction is full of inconsistencies

  50. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    But I hope to pull off something solid out of it though

  51. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Can you visualize the codes? I am nowhere close to being that proficient..

  52. Empty
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 2

    Ok well first things first I'll comment on what you've done so far and then I'll tell you a little about how I approach programming now and what it was like learning it about two years ago. So what Eclipse does is really nothing. It's more like just a "spell checker for code" and it helps you create stuff easier. But when you do stuff, you're writing Java code and then Eclipse just makes it easy to compile and run your code. Compiling code just means that it turns it from what you can read into something that the computer can read, since the computer doesn't actually run the code you write, it has to get translated. In addition to that, when code is compiled it tends to get optimized to become faster. What I mean by saying all that is that you will have to write code to extract the number of words and spaces and vowels in your Java code, Eclipse won't do that sort of thing for you. So you're on the right path with what you've done so far I think for the most part, now you must use the BufferedReader to find what you want. I suggest (although it will seem very overwhelming to you now try to just do your best) looking at the Java docs. http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html Just try to get familiar with it. Every time you use something new, try to look up the Javadocs to get a feel for what you can do with it, it will help in solving problems later if you can think "Oh I remembered there was such and such method that I might be able to use." The second thing I wanted to say about like visualizing code and stuff I'll say in a moment I'm still sorta distracted.

  53. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks so much for your tips. I will definitely use my problem solving skill to approach the problem one way or the other I mean there has to a way right? I will definitely use your link and see what I can salvage off it. And to that distraction part we all struggle with it you are not the only one:)

  54. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Obviously there is going to be throwing about of brains but I'll let you know how it goes.

  55. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Buffer reader-System that allows for reading of input stream. Arrays, lines, and characters are all processed by Buffer readers.

  56. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    One additional knowledge to my brain lol

  57. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    well, right now, you're just reading every line from message.txt.docx and dumping it to the standard output stream. it seems the goal is to instead write a program to *write* ten lines of text to message.txt

  58. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    now, you're familiar with `BufferedReader` but I think you should also check out documentation on `BufferedWriter` and specifically wrapping it in a `PrintWriter`: https://docs.oracle.com/javase/8/docs/api/java/io/BufferedWriter.html

  59. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    this will help you write rather than read lines from a text file. consider: ``` final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("message.txt"))); /* example: write "hello" to the file */ writer.println("hello"); /* now clean everything up */ writer.close(); ``` also instead of signaling the compiler to suppress warnings, you should just listen to it and make sure you clean up after yourself and release any resources (like the file handle you've acquired for reading/writing to a file)

  60. anonymous
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    alternatively you can use the Java 7 NIO.2 file API to acquire a writer: ``` import java.nio.file.Path; import java.nio.file.Files; ... final Path path = Paths.get("message.txt"); final PrintWriter writer = new PrintWriter(Files.newBufferedWriter(path)); ```

  61. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.