QBR + Slugging

import java.util.*; public class QBR { public QBR() { // initialise instance variables Scanner scan = new Scanner(System.in); System.out.println("input comp"); int comp = scan.nextInt(); System.out.println("input att"); int att = scan.nextInt(); System.out.println("input yds"); int yds = scan.nextInt(); System.out.println("input td"); int td = scan.nextInt(); System.out.println("input ints"); int ints = scan.nextInt(); double a = ((double)comp/att - .3) * 5.0; double b = ((double)yds/att - 3) * .25; double c = ((double)td/att) * 20; double d = 2.375 - ((double)ints/att * 25); System.out.println("input comp2"); int comp2 = scan.nextInt(); System.out.println("input att2"); int att2 = scan.nextInt(); System.out.println("input yds2"); int yds2 = scan.nextInt(); System.out.println("input td2"); int td2 = scan.nextInt(); System.out.println("input ints2"); int ints2 = scan.nextInt(); double a2 = ((double)comp2/att2 - .3) * 5.0; double b2 = ((double)yds2/att2 - 3) * .25; double c2 = ((double)td2/att2) * 20; double d2 = 2.375 - ((double)ints2/att2 * 25); if (a<0){ a = 0; } if (b<0){ b = 0; } if (c<0){ c = 0; } if (d<0){ d = 0; } if (a>2.375){ a = 2.375; } if (b>2.375){ b = 2.375; } if (c>2.375){ c = 2.375; } if (d>2.375){ d = 2.375; } if (a2<0){ a2 = 0; } if (b2<0){ b2 = 0; } if (c2<0){ c2 = 0; } if (d2<0){ d2 = 0; } if (a2>2.375){ a2 = 2.375; } if (b2>2.375){ b2 = 2.375; } if (c2>2.375){ c2 = 2.375; } if (d2>2.375){ d2 = 2.375; } double pr = ((a+b+c+d)/6) * 100; double pr2 = ((a2+b2+c2+d2)/6) * 100; System.out.println("pr1:" + (int)pr); System.out.println("pr2:" + (int)pr2); } } ------------------- /** * Write a description of class slugging here. * * @author (your name) * @version (a version number or a date) */ import java.util.*; public class slugging { // instance variables - replace the example below with your own public slugging() { Scanner scan = new Scanner(System.in); System.out.println("input ab"); double ab = scan.nextDouble(); System.out.println("input hits"); double hits = scan.nextDouble(); System.out.println("input doubles"); double doubles = scan.nextDouble(); System.out.println("input triples"); double triples = scan.nextDouble(); System.out.println("input hr"); double hr = scan.nextDouble(); double tb1 = hits + doubles + (2 * triples) + (3*hr); double slg1 = tb1/ab; System.out.println("input ab2"); double ab2 = scan.nextDouble(); System.out.println("input hits2"); double hits2 = scan.nextDouble(); System.out.println("input doubles2"); double doubles2 = scan.nextDouble(); System.out.println("input triples2"); double triples2 = scan.nextDouble(); System.out.println("input hr2"); double hr2 = scan.nextDouble(); double tb2 = hits2 + doubles2 + (2 * triples2) + (3*hr2); double slg2 = tb2/ab2; System.out.println("slg1: " + slg1); System.out.println("slg2: " + slg2); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.