Assignemnt #99 Fill In Function

Code

    ///Name: Morgan Kaplan
    ///Period: 5
    ///Project Name: Fill Im Function
    ///File Name: FIM.java
    
// Fill-In Methods - Fix the broken methods and method calls.

public class FIM
{
	public static void main( String[] args )
	{
		// Fill in the method calls where appropriate.

		System.out.println("Watch as we demonstrate methods.");

		System.out.println();
		System.out.println("I'm going to get a random character from A-Z");
		char c = 'n';
		
        randChar();
		

		System.out.println();
		System.out.println("Now let's count from -10 to 10");
		int begin, end;
		begin = -10;
		end = 10;
		
        int start=0;
        int stop=0;
            
        counter(start, stop);
            
		System.out.println("How was that?");

		System.out.println();
		System.out.println("Now we take the absolute value of a number.");
		int x, y = 10;
		x = -10;
		
       int value=0;
        int absval=0;
        abso(value, absval);
        
		System.out.println("|" + x + "| = " + y );

		System.out.println();
		System.out.println("That's all.  This program has been brought to you by: Momo");
		
        credits();
        
	}

	public static void credits()
	// No parameters.
	{
		// displays some boilerplate text saying who wrote this program, etc.

		System.out.println();
		System.out.println("programmed by Graham Mitchell");
		System.out.println("modified by Momo");
		System.out.print("This code is distributed under the terms of the standard ");
		System.out.println("BSD license.  Do with it as you wish.");
	}

	public static void randChar()
	// No parameters.
	{
		// chooses a random character in the range "A" to "Z"
		
		int numval;
		char charval;

		// pick a random number from 0 to 25
		numval = (int)(Math.random()*26);
		// now add that offset to the value of the letter 'A'
		charval = (char) ('A' + numval);

		System.out.println(" " + charval + "");
	}
    
	public static void counter(int start, int stop)
	
	{
        start=-11;
        stop=9;
        // counts from start to stop by ones
		int ctr;

		ctr = start;
		while ( ctr <= stop )
		{
			ctr = ctr+1;
            System.out.print(ctr + " ");
		}

	}
    
	public static void abso(int value, int absval)
	{
		value=-10;
        // finds the absolute value of the parameter

		if ( value < 0 )
			 absval = -value;
		else
			 absval = value;

		System.out.println(" " + absval + " ");
	}

}
    

Picture of Output

Assignment 99