tehhax0r 0 Newbie Poster

I have an assignment for a class i'm having trouble with heres the prompt:


Research reports are required to conform to a given standard (e.g., APA, MLA). These standards specify rules such as the size of the margins, formats for titles, paragraphs, references, page numbers, etc. Consider a program that is required to produce a report conforming to a standard. It would be desirable to use a utility class that automatically produces a report according to the specified standard. By using the utility class, a program need only supply the content. The utility class may provide methods such as printParagraph(String test), printTitle(String title), printReference(String author, String title, int year, String publisher), printLine(String) and breakPage().

Develop a utility class to provide the above stated methods. Define a constructor for the class that takes number of columns in a page, number of lines in a page, and the author’s name. The class is to perform the following formatting:

• The first line of every page after the first page is to print left-justified the author’s name and page number.
• The second and third lines (at the top), and the last three lines of each page are to be blank. The first line of the first page is also blank.
• printTitle is to print a title centered justified, followed by a blank line, except when the paragraph completes on the last printable line of a page.
• printParagraph is to perform word wrap. A blank line must follow a paragraph, except when the paragraph completes on the last printable line of a page.
• printReference is to format a reference paragraph. That is the paragraph is to have a comma between each item, perform word wrap if needed. A blank line is printed after a reference, except when the paragraph completes on the last printable line of a page.
• breakPage() method will print enough blank lines to complete the current page.

Include getter methods to get the instance variables (e.g. include a getAuthor() so that printTitle(getAuthor())) can be used to print the author centered as a title.

You can assume a fixed width font.

Write a test program to thoroughly test your class.

Abide by good programming practices (e.g., naming conventions, javadoc, indentation, use of braces, etc.).

For this assignment you just need one ReportWriter class and a test class. You DO NOT need to create classes for a complete word processor (e.g., Paragraph, Word, Sentence, etc.).

here is what i have so far. here is my ReportWriter class

public class ReportWriter {
	private int numberColumns;
    private int numberLines;
    private String author;
    private int pageNumber;
    private final int lMargin = 5;
    private final int rMargin = 5;
    private final int tMargin = 3;
    private final int bMargin = 5;
    private int lengthForCenter;
    private int lineNumber;
 
 
    public ReportWriter(int numberColumns, int numberLines, String author){
 
        this.author = author;
        this.numberColumns = numberColumns;
        this.numberLines = numberLines;
        this.pageNumber = 1;
 
 
    }
 
    public void printParagraph(String testParagraph){
        int index= 0;
        if (testParagraph.charAt(index) == ' ') {
        	
            testParagraph.substring(10);    
        }
        else{
            index++;
            
        }
        System.out.println(testParagraph);
 
    }
    public void printTitle(String title)
    {
            String line = "";
            for (int x = 0; x<this.tMargin; x++){
                line += " ";
            }
            lengthForCenter = (numberColumns - title.length())/2;
     
            for(int y =0; y < lengthForCenter; y++){
                line += " ";
            }
     
            line += title;
            printLine(line);
            printLine("");
    }
    
 
    private void printLine(String line) {
        if(lineNumber == numberLines - bMargin){
            System.out.println();
            if(lineNumber == 5){
                pageNumber++;
            }
 
            lineNumber = 0;
        }
        System.out.println(line);
 
    }
 
    public void printReference(String author, String title, int year, String publisher){
 
    }
    public String getAuthor() {
        return author;
    }
    public int getNumberColumns() {
        return numberColumns;
    }
    public int getNumberLines() {
        return numberLines;
    }
 
 
}

any help would be appreciate, my output is giving my paragraph all in one line

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.