CSC407/ECE450 Assignment 1b Sample Solution

plan.report
Class Report

java.lang.Object
  |
  +--plan.report.Report

public class Report
extends java.lang.Object

Utility class for printing text-oriented reports to standard output.


Field Summary
private static java.lang.String HEAD
           
private static java.lang.String LINE
           
private static java.lang.String PICT
           
private static int WIDTH_CHAMP
           
private static int WIDTH_CUST
           
private static int WIDTH_DESC
           
private static int WIDTH_ID
           
private static int WIDTH_PRIO
           
private static int WIDTH_SIZE
           
 
Constructor Summary
private Report()
          Entirely static class.
 
Method Summary
(package private) static java.lang.String customerDesirability(Feature f)
          Return a string that expresses the desirability by customers of the specified feature.
(package private) static void writeFeature(Feature f)
          Write details for the given feature.
static void writeFeatures(java.lang.String title, FeatureList fl)
          Write out details for all the features in the specified FeatureList.
(package private) static void writeField(java.lang.String s, int width)
          Write the given string in a filed of the given width.
static void writeHeader(java.lang.String head)
          Write the report header.
static void writeSummaryTable(FeatureList[] fl)
          Write a table summarizing the number of features and their sizings.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

LINE

private static final java.lang.String LINE

PICT

private static final java.lang.String PICT

HEAD

private static final java.lang.String HEAD

WIDTH_ID

private static final int WIDTH_ID

WIDTH_DESC

private static final int WIDTH_DESC

WIDTH_PRIO

private static final int WIDTH_PRIO

WIDTH_SIZE

private static final int WIDTH_SIZE

WIDTH_CHAMP

private static final int WIDTH_CHAMP

WIDTH_CUST

private static final int WIDTH_CUST
Constructor Detail

Report

private Report()
Entirely static class. Ensure no instances are created.
Method Detail

writeHeader

public static void writeHeader(java.lang.String head)
Write the report header.
Parameters:
head - the header message to be printed

writeSummaryTable

public static void writeSummaryTable(FeatureList[] fl)
Write a table summarizing the number of features and their sizings. The table has the feature lists along the columns and four rows: Each entry in the table gives the number of features and the sum of the sizings.
Parameters:
fl - the variouos FeatureLists comprising the columns

writeFeatures

public static void writeFeatures(java.lang.String title,
                                 FeatureList fl)
Write out details for all the features in the specified FeatureList.
Parameters:
title - a title for this section of the report
fl - the list of features to print

writeFeature

static void writeFeature(Feature f)
Write details for the given feature.
Parameters:
f - the feature to print

writeField

static void writeField(java.lang.String s,
                       int width)
Write the given string in a filed of the given width. If the length of the string is bigger than the field width, replace the end of the string by a "...".
Parameters:
s - the string to print in the field
width - the field width

customerDesirability

static java.lang.String customerDesirability(Feature f)
Return a string that expresses the desirability by customers of the specified feature.
Parameters:
f - the features whose customer desirability is to be returned
Returns:
a textual expression of the desirability

CSC407/ECE450 Assignment 1b Sample Solution