/
Help.java
69 lines (61 loc) · 2.05 KB
/
Help.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package ws.thurn.dossier;
import java.io.IOException;
/**
* The Help class produces help for the program in a number of ways depending on
* what parameter it was passed.
*
* @author Derek Thurn
*/
public class Help
{
String typeOfHelp;
// The type of help desired.
/**
* Creates the help object and activates the right help process
*
* @pre a correct type of help is passed
* @post the corresponding action is taken
* @param hlp the type of help desired
*/
public Help( String hlp )
{
typeOfHelp = hlp;
help();
}
/**
* Either displays a quick prompt or loads the User Manual
*
* @pre one of the four types of help has been declared, the correct files
* are all in place.
* @post either a prompt is displayed or one of the User Manual formats is
* loaded.
*/
public void help()
{
try
{
if( typeOfHelp.equals( "start" ) )
{
GradeBook
.info( "To get started, create a class by pressing the class button. You can then\nadd students to the class. After this, create assignments for the class\nusing the Assignments button, then enter grades for the class using the\nGrades button. When you're finished, the Reports button can be used to\nview the information. See the guide for more comprehensive user information." );
}
if( typeOfHelp.equals( "doc" ) )
{
Runtime.getRuntime().exec( "doc.bat" );
}
if( typeOfHelp.equals( "pdf" ) )
{
Runtime.getRuntime().exec( "pdf.bat" );
}
if( typeOfHelp.equals( "html" ) )
{
Runtime.getRuntime().exec( "html.bat" );
}
}
catch( IOException e )
{
GradeBook
.error( "Problem finding the required file. Please reinstall the program." );
}
}
}