1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Football simulator help!!!!!!

Discussion in 'Java' started by luettke10, May 6, 2010.

  1. luettke10

    luettke10 New Member

    Joined:
    Mar 30, 2010
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    I need someone to make a football simulator for me. It needs to be a college football simulator where the user inputs two teams and then the program outputs a winner to the user. It would be a very simple program and the simulation would be based off the ranks of the teams. Thank you for the help.
     
  2. luettke10

    luettke10 New Member

    Joined:
    Mar 30, 2010
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    I also need to know how to use decimals in Java Programming
     
  3. luettke10

    luettke10 New Member

    Joined:
    Mar 30, 2010
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    This is what I have so far:
    Code:
    import java.io.* ;
    
    class Tut2 {
         public static void main(String args[])
        
         {
              InputStreamReader istream = new InputStreamReader(System.in) ;
              BufferedReader bufRead = new BufferedReader(istream) ;
    
              System.out.println("Welcome To My First Java Program");
    
              try {
                   System.out.println("Please Enter Higher Ranked Team ");
                   String firstName = bufRead.readLine();
    
                   System.out.println("Please Enter Lower Ranked Team ");
                   String bornYear = bufRead.readLine();
    
                   System.out.println("Please Enter Rank of Higher Ranked Team ");
                   String higher = bufRead.readLine();
                   
                   System.out.println("Please Enter Rank of Lower Ranked Team ");
                   String lower = bufRead.readLine();
    
                   int low = Integer.parseInt(lower);
                   int high = Integer.parseInt(higher);
                   float num1 = .84f;
    
                   int x = low - high;
                   
                   float t = x * num1;
                   
                   float m = 100f - t;
                   
                System.out.println("Percentage "+ firstName +" wins is " + t + "%");
                System.out.println("Percentage "+ bornYear +" wins is " + m + "%");
              }
              catch (IOException err) {
                   System.out.println("Error reading line");
              }
              catch(NumberFormatException err) {
                   System.out.println("Error Converting Number");
              }   
         }
    }
    I need it to recognize "m" and "t" as percentages and then based off of the those pick one of them. I know how to show the winner I just need to know how to get the program to pick the winner or if it is possible to do this.
     
    Last edited by a moderator: May 8, 2010

Share This Page