Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Football simulator help!!!!!! (http://www.go4expert.com/forums/football-simulator-help-t22025/)

luettke10 7May2010 01:17

Football simulator help!!!!!!
 
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.

luettke10 7May2010 21:11

Re: Football simulator help!!!!!!
 
I also need to know how to use decimals in Java Programming

luettke10 8May2010 01:50

Re: Football simulator help!!!!!!
 
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.


All times are GMT +5.5. The time now is 09:21.