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
 * @version 10/5/11
 */
 
 
public class PracticeVariables
{
    //This method is to allow you to practice printing
    public void practicePrinting()
    {
     
    }
 
    //This method is to practice with variables
    public void practiceVariables()
    {
     
    }
   
    //This method is to practice with methods with one parameter
    public void findSquare(int x)
    {
        
    }
    
    //This method below is to practice with methods with parameters
    //You need to multiply the 2 numbers and print the product (nicely)
    public 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.
    public 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.0505 Canadian dollars
    //So 8 us dollars = 8*1.0505   
    public 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.0505 Canadian dollars
    //So 8 can dollars = 8/1.0505
    public 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 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 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 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 void findCelsius(double fahrenheit)
    {
        System.out.println("The code for this method needs to be added.");       
    }          
 
    //Extra credit below (required for those taking AP)
    //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 void findRoots(int a, int b, int c)
    {
        System.out.println("The code for this method needs to be added.");
    }

      
    //Extra credit below (required for those taking AP)
    //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 void findTax(double price)
    {
        System.out.println("The code for this method needs to be added.");
    }  
    
    //Extra credit below (required for those taking AP)
    //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 void findTax(double price, double tax rate)
    {
        System.out.println("The code for this method needs to be added.");
    }        
      
}