email me at borlaj@portlandschools.org
notes previous (09/07/06) submit the dump links  
 

HW Java-1 To be submitted online.

Write the code for the following methods. Email me any questions.

notes:

/** This is the shell of code to practice with variables
 *
 * @author J. Borland (change to your name)
 * @version 4.0
 **/
 
public class PracticeVariables
{
    //This method is to allow you to practice printing
    public static void practicePrinting()
    {
 
    }
 
    //This method is to practice with variables
    public static void practiceVariables()
    {
 
    }
 
    //This method is to practice with methods with one parameter
    public static void findSquare(int x)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //This method below is to practice with methods with parameters
    //You need to multiply the 2 numbers and print the product (nicely)
    public static void multiplyNumbers (int x, int y)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //This method below is to find the next 2 numbers and print them out. (so if they put in 12, it will print 13 and 14 are the next numbers
    public static void findNextNums (int x)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //This method below is to change some amount of money from US to Canadian
    //Currently the exchange rate is 1 US dollar = 1.32 Canadian dollars
    //So 8 us dollars = 8*1.32   
    public static void changeToCanadian (double usCurrency)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //This method below is to change some amount of money from Canadian to US
    //Currently the exchange rate is 1 US dollar = 1.32 Canadian dollars
    //So 8 can dollars = 8/1.32
    public static void changeToUS (double canCurrency)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //This method will find the circumference given the radius and output that to screen
    public static void findCircumference(int radius)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //This method finds the average of 2 numbers - careful.
    public static void findAverage(int number1, int number2)
    {
        System.out.println("The code for this method needs to be added.");       
    }   
 
    //Convert the celsius to fahr -  F=9/5C+32
    public static void findFahr(double celsius)
    {
        System.out.println("The code for this method needs to be added.");       
    }      
 
    //Convert the fahrenheit to celsius -  C= 5/9 (F-32)
    public static void findCelsius(double fahrenheit)
    {
        System.out.println("The code for this method needs to be added.");       
    }          
    //*********************************************************************************************************//
    //ALL BELOW Extra credit (required for those taking AP and other hot shots)
    //*********************************************************************************************************//
    //Use the quad formula to find both roots and print them out.
    //Look up quad formula if you forgot it.
    //To do square root, its Math.sqrt(the number)
    //For example double theSqRtOf25 = Math.sqrt(5); 
    public static void findRoots(int a, int b, int c)
    {
        System.out.println("The code for this method needs to be added.");
    }
 
    //Find the total cost of an item below if tax rate is 5% like in Maine
    //So if the price was 100 it might say:
    //The tax is $5 and the total is $105
    public static void findTax(double price)
    {
        System.out.println("The code for this method needs to be added.");
    }  
 
    //Find the total cost of an item below given a price and tax rate
    //So if the price was 100 and the tax rate was 7% it might say:
    //The tax is $7 and the total is $107
    public static void findTax(double price, double taxRate)
    {
        System.out.println("The code for this method needs to be added.");
    }        
 
    //*********************************************************************************************************//
    //Super Advanced - you will need loops, look them up.
    //*********************************************************************************************************//
    //Finds the least common multiple of x and y
    public static void findLCM(int x, int y)
    {
        System.out.println("The code for this method needs to be added.");
    }    
 
    //*********************************************************************************************************//
    //Super Advanced - you will need loop in a loop, look them up.
    //*********************************************************************************************************//
    //Prints all the primes up to and including x 
    public static void findPrimes(int x)
    {
        System.out.println("The code for this method needs to be added.");
    }       
}