I hope this is the right section:
I have some assignment I need to be working on and once you finish each one your suppost to get it checked by a program called “gide” and this program is super super pickey with java standards.
It was made by one of my instructor and it automaticly checks if you followed the standards and if mess up 4 times with the standards you fail.
So I am getting like alot of errors and I don’t even know what 90% of them mean.
Question 1:
Write an application that reads values representing a time duration in hours,minutes and seconds and then prints the quivalent totoral number of seconds (For example, 1 hour, 28 minutes and 42 seconds is equivalent to 5322 seconds)
/**
* ToSeconds is the main class where all the converting of time will be done
* This program will allow a user to input any amount of hours,minutes &
* seconds and find out how many seconds it is.
*
* @author My Name
* @version 1.0
*/
import java.util.Scanner;
public class ToSeconds
{
/*
Following statements takes the users input and converts it to seconds
*/
public static void main (String[] args)
{
int hour;
int min;
int sec;
/*
*Below takes an hour what is 60mins and times it by 60secs
*/
final int MAX_HOUR =60*60;
final int MAX_MIN =60; // this shows that there is 60mins
final int TOTAL;
Scanner scan = new Scanner (System.in);
System.out.println(" Enter the number of hours ");
hour = scan.nextInt(); // scans what was inputed and holds it in hour
System.out.println(" Enter the number of minutes ");
min = scan.nextInt(); // scans what was inputed and holds it in min
System.out.println(" Enter the number of seconds ");
sec = scan.nextInt(); // scans what was inputed and holds it in sec
/*
* The statement below takes the user inputs and converts it into seconds
* and holds it in TOTAL
*/
TOTAL=(hour*MAX_HOUR) + (min*MAX_MIN) + (sec);
System.out.println(" Your total time " + TOTAL + " converted into seconds");
}
}
So that is what I got. As you can probably notice I am a big noob and one of the things I suck at is naming things like all I could think of was MAX_HOUR and stuff like that but it seems to all work though.
now these are the errors I get:
Course : COMP 1510
Assignment : sample
Name :
Set :
Automated Mark: 0.00 / 10.00
Manual Mark : ___.__ / 15.00
Total Mark : 0.00 / 25.00
------------------------------------------------------------
Style: 0.00 / 10.00
Lint 0.00 / 10.00
------------------------------------------------------------
Additional: ___.__ / 15.00
__.__ / 5.00 for Understandable-code
__.__ / 5.00 for Sensible-variable-names
__.__ / 5.00 for Valuable-inline-comments
------------------------------------------------------------
Checkstyle Coding :
ToSeconds.java (31:12): Variable 'scan' should be declared final.
Checkstyle Javadoc Comments :
ToSeconds.java (12:0): Missing a Javadoc comment.
ToSeconds.java (18:4): Missing a Javadoc comment.
Checkstyle Miscellaneous :
ToSeconds.java (12:0): class def ident at indentation level 3 not at correct indentation, 0
ToSeconds.java (12:0): class def modifier at indentation level 3 not at correct indentation, 0
ToSeconds.java (19:0): method def lcurly at indentation level 0 not at correct indentation, 3
ToSeconds.java (20:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (21:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (22:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (27:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (28:0): Don't use trailing comments.
ToSeconds.java (28:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (29:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (31:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (33:0): method call child at indentation level 3 not at correct indentation, 6
ToSeconds.java (33:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (34:0): Don't use trailing comments.
ToSeconds.java (34:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (36:0): method call child at indentation level 3 not at correct indentation, 6
ToSeconds.java (36:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (37:0): Don't use trailing comments.
ToSeconds.java (37:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (39:0): method call child at indentation level 3 not at correct indentation, 6
ToSeconds.java (39:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (40:0): Don't use trailing comments.
ToSeconds.java (40:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (48:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (50:0): method call child at indentation level 3 not at correct indentation, 6
ToSeconds.java (50:0): method def child at indentation level 3 not at correct indentation, 6
ToSeconds.java (51:0): method def rcurly at indentation level 0 not at correct indentation, 3
Checkstyle Naming Conventions :
ToSeconds.java (27:14): Name 'MAX_HOUR' must match pattern '^[a-z][a-zA-Z0-9]*$'.
ToSeconds.java (28:14): Name 'MAX_MIN' must match pattern '^[a-z][a-zA-Z0-9]*$'.
ToSeconds.java (29:14): Name 'TOTAL' must match pattern '^[a-z][a-zA-Z0-9]*$'.
Checkstyle Whitespace :
ToSeconds.java (18:27): 'main' is followed by whitespace.
ToSeconds.java (27:24): '=' is not followed by whitespace.
ToSeconds.java (27:26): '*' is not preceded with whitespace.
ToSeconds.java (27:27): '*' is not followed by whitespace.
ToSeconds.java (28:23): '=' is not followed by whitespace.
ToSeconds.java (31:30): 'Scanner' is followed by whitespace.
ToSeconds.java (48:9): '=' is not preceded with whitespace.
ToSeconds.java (48:10): '=' is not followed by whitespace.
ToSeconds.java (48:15): '*' is not preceded with whitespace.
ToSeconds.java (48:16): '*' is not followed by whitespace.
ToSeconds.java (48:32): '*' is not preceded with whitespace.
ToSeconds.java (48:33): '*' is not followed by whitespace.
------------------------------------------------------------
like some of these things I don’t know what they are like the javadocs I read about them in my book but I don’t know how to make them really. Yet at the same time I can’t trust me book because some of the stuff they have written there does not follow what my teacher wants.
Here is some more info about my assignement:
. For this assignment, the Javadoc comments required are a header comment block as described below.
For this assignment, each program will consist of a single class, with the name as given above.
Comments and documentation
Each class must have a Javadoc header block comment immediately before the class statement. This must have the following format:
/**
* Introductory summary sentence describing the class.
*More complete description of everything the class is supposed to do(may be several
* lines long
*
* @author name of author of the code
* @version version number, such as 1.0
*/
Each paragraph should be separated from the next by a <p> tag. If you need to use lists or tables in the description, you should use HTML tags.
Example header block:
/**
* Graphics is the abstract base class for all graphics contexts
* which allow an application to draw onto components realized on
* various devices or onto off-screen images.
* A Graphics object encapsulates the state information needed
* for the various rendering operations that Java supports. This
* state information includes:
* <ul>
* <li>The Component to draw on
* <li>A translation origin for rendering and clipping coordinates
* <li>The current clip
* <li>The current color
* <li>The current font
* <li>The current logical pixel operation function (XOR or Paint)
* <li>The current XOR alternation color
* (see <a href="#setXORMode">setXORMode</a>)
* </ul>
* <p>
* Coordinates are infinitely thin and lie between the pixels of the
* output device.
* Operations which draw the outline of a figure operate by traversing
* along the infinitely thin path with a pixel-sized pen that hangs
* down and to the right of the anchor point on the path.
* Operations which fill a figure operate by filling the interior
* of the infinitely thin path.
* Operations which render horizontal text render the ascending
* portion of the characters entirely above the baseline coordinate.
* <p>
* Some important points to consider are that drawing a figure that
* covers a given rectangle will occupy one extra row of pixels on
* the right and bottom edges compared to filling a figure that is
* bounded by that same rectangle.
* Also, drawing a horizontal line along the same y coordinate as
* the baseline of a line of text will draw the line entirely below
* the text except for any descenders.
* Both of these properties are due to the pen hanging down and to
* the right from the path that it traverses.
* <p>
* All coordinates which appear as arguments to the methods of this
* Graphics object are considered relative to the translation origin
* of this Graphics object prior to the invocation of the method.
* All rendering operations modify only pixels which lie within the
* area bounded by both the current clip of the graphics context
* and the extents of the Component used to create the Graphics object.
*
* @author Sami Shaio
* @author Arthur van Hoff
* @version %I%, %G%
*/
You might have to copy my code into a editor so you can see what going on which lines.