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

HWJ4 - More string exercises:

Start with the file below and use it to create the 4 methods described.

/*
 * This simple class is to test the Scanner class' ability to read user input.
 * @author Jeff Borland
 * @date 10-17-7
 */

import java.util.Scanner;
public class HWJ4
{

    //Ask the user for 2 numbers and spit out the average
    public void findAvg()
    {
		//You will need the following line in all methods.
		Scanner scan=new Scanner(System.in);  //The Scanner constructor requires the use of the io class
    
        //add your code here
        
    } 
    
    //Ask the user for a name of a player and how many hits and how many at bats
    //So the user will type in Barry Bonds, 150, 420 and then display Barry Bonds has an average of .3571...
    public void findBattingAVG()
    {
		//You will need the following line in all methods.
		Scanner scan=new Scanner(System.in);  //The Scanner constructor requires the use of the io class
    
        //add your code here
        
    }  
    
    //Ask the user for a word and a character and then return yes, that letter is in the word or no, that letter is not in the word.  
    //You will need to use the methods that belong to 
    public void wheelOfFortune()
    {
        
    }
    
    //ask for tax rate and price of item and it will display total price
    // ie if item is 50 and tax is 5 (as in 5%), the total price is 52.50.
    public void totalPrice ()
    {
    }
    
    

Extra credit for high flyer
(note on loops)
     //Ask the user for a number of miles for a taxi ride and then ask for 
    // cost per mile and pickup cost.  
    //Then spit out total charge (which is #of miles *cost per mile + pickup cost
    public void findTaxiCostV2()
    {
        //You will need the following line in all methods in order to initialize the scanner.
        Scanner scan=new Scanner(System.in);  //The Scanner constructor requires the use of the io class
    
        //add your code here
        
    } 
    
    //create a method that will keep asking for a grade until the user hits -1.  They will then
    //find the average of those grades
    // you will need to use loops
    public void findAverage()
    {
    }