Printing Booklets ( Due 01 Feb 2013 )

The purpose of this assignment is to read data from a file and write out results to a file and use Eclipse for program development.

Normally when a document is printed the first page is printed first, then the second page, and so on till the last page. However to create a fold-over booklet the order of printing has to be changed. In a fold-over booklet there are four pages that are printed on a sheet - two pages on the front and two pages on the back. The sheets are stacked up on one another and then folded to form the booklet. The pages should now be in the correct order.

Supposing you have a 8 page booklet, then you need 2 sheets of paper. This will be the order in which the pages will be printed on those sheets.


SHEET 1      Front                          Back
	     ---------------------           ---------------------
	     |         |         |           |         |         |
	     |    8    |    1    |           |    2    |    7    |
	     |         |         |           |         |         |
	     ---------------------           ---------------------


SHEET 2      Front                          Back
	     ---------------------           ---------------------
	     |         |         |           |         |         |
	     |    6    |    3    |           |    4    |    5    |
	     |         |         |           |         |         |
	     ---------------------           ---------------------

Your program will prompt the user to enter the name of the input and output file. The input file will have the number of pages to be printed - one line per booklet. The output file will have the printing order for each booklet. In case the number of pages do not fill the sheets completely, some of the pages will be empty. Write the word Blank for those empty pages instead of numbers. The output should be in order by sheet - with the front first and then the back.

Sample Input File:

1
5

Sample Output File:

Printing order for a booklet of 1 pages:
Sheet 1,  front: Blank, 1
Sheet 1,  back: Blank, Blank

Printing order for a booklet of 5 pages:
Sheet 1,  front:  Blank, 1
Sheet 1,  back:  2, Blank
Sheet 2,  front:  Blank, 3
Sheet 2,  back:  4, 5

You will have two classes - PrintBooklet and Booklet. The class PrintBooklet will have the method main(). In the method main() you will prompt the user to enter the names of the input and output file. The class Booklet will have methods to open the input file, read the contents, create the output file and write out the printing order. The following is a sample output on the console:

Enter input file: booklet.txt

Enter output file: pages.txt

Output written out to pages.txt

The file that you will be turning in will be called PrintBooklet.java. The file will have a header of the following form:

/*
  File: PrintBooklet.java

  Description:

  Student Name:

  Student UT EID:

  Partner Name:

  Partner UT EID:

  Course Name: 329E

  Unique Number: 53390

  Date Created:

  Date Last Modified:

*/

You will follow the standard Java Coding Conventions. You can either view the HTML page or download the PDF or Postscript and print it out. There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code.

In the lab show Tong Zhao your working code in Eclipse. If you have been working with a partner then both of you will submit the program independently to the turnin system by 11 pm on Friday 01 Feb 2013.