Git Product home page Git Product logo

retrojava's Introduction

RetroJava

create a commandline program for counting the lines, words and characters within a set of files.

(like it used to be done in the Olden Days).

Create, using a standard text editor like nano, two class files (CountInFile.java & FileCounting.java) that will produce the following output when run from the shell:

$ java CountInFile *.txt
      34     268    1425 antonysspeech.txt
      75     458    2783 chineseproverbs.txt
      70     758    4193 flushingremonstrance.txt
      11      99     649 preamble.txt
      12     106     713 primedirective.txt

Use ONLY nano, javac, and other command line tools to create this program.

DO NOT use IntelliJ, or other code editors.

The point of this lab is to understand how to create a java program using only shell tools. All the .txt files are just samples of text and just used as input. (If it matters, they are all in UTF-8 format.)

CountInFile should get the command line arguments, and then create a FileCounting object and call a method named:

public String ScanTheFile(String filename) which returns

34 268 1425 antonysspeech.txt when handed "antonysspeech.txt"

CountInFile should do this for each file passed on the command line when invoked from the shell.

What does a .class file do? How do you get one from a .java file

You may, should you find it necessary, use a command line tool called make.

NOTA BENE: You may need to understand the difference between a string's length and the byte[] that it actually uses. This comes into play when looking at the file with the chinese characters in it.

NOTA BENE: If you want to understand what program you are trying to mimic, use wc without any commandline flags.

You should only need the two supplied JAR files with the JUnit testing stuf in them.

Some more pointers.

When looking at the this lab, you should consider it a chance to learn how to use a terminal based screen editor for text files. You might use Nano or Vim (or even, gasp, Emacs) https://medium.com/linode-cube/emacs-nano-or-vim-choose-your-terminal-based-text-editor-wisely-8f3826c92a68 You may also need (and you should) use make to handle not having to type long java compile and test lines when you run your compiler on the code you develop. https://www.cs.swarthmore.edu/~newhall/unixhelp/javamakefiles.html

retrojava's People

Contributors

xt0fer avatar k-law21 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.