Advertisement
RazorBlade57

Java Script Number Lab

Sep 22nd, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.54 KB | None | 0 0
  1. import java.util.Random;
  2. public class CompSci
  3. {
  4.    public static void main ( String[] args )
  5.    {
  6.     //define 1 variable of each of the
  7.     //following data types
  8.     //byte  short       int         long
  9.     //float double
  10.     //char      boolean String
  11.  
  12.  
  13.     Random r = new Random();
  14.        
  15.     //integer variables
  16.     byte byteOne = 127;
  17.     short shortOne = -32123;
  18.     int intOne = 90877;
  19.     long longOne = 99999999;
  20.     float floatOne = 38.5678f;
  21.     double doubleOne = 923.234;
  22.     char charOne = 65;
  23.     boolean booleanOne = true;
  24.     String stringOne = "hello world";
  25.     double one = 15.0;
  26.     int result = r.nextInt(50);
  27.         result = result + 1;
  28.     int number = r.nextInt(50);
  29.     double two = r.nextInt(50);
  30.     int addition = result + number;
  31.     double plus = one + two;
  32.     char wow = '&';
  33.    
  34.    
  35.    
  36.    
  37.    
  38.    
  39.     System.out.println("/////////////////////////////////");
  40.     System.out.println("*Chris Nick             09/22/16*");
  41.     System.out.println("*                               *");
  42.     System.out.println("*        integer types          *");
  43.     System.out.println("*                               *");
  44.     System.out.println("*8 bit - byteOne = " + byteOne + "\t\t*");
  45.     System.out.println("*16 bit - shortOne = " + shortOne + "\t*" );
  46.     System.out.println("*32 bit - intOne = " + intOne + "\t*");
  47.     System.out.println("*64 bit - longOne = " + longOne + "\t*");
  48.     System.out.println("*                               *");
  49.     System.out.println("*         real types            *");
  50.     System.out.println("*32 bit - floatone = " + floatOne + "\t*");
  51.     System.out.println("*64 bit - doubleOne = " + doubleOne + "\t*" );
  52.     System.out.println("*                               *");
  53.     System.out.println("*     other integer types       *");
  54.     System.out.println("*                               *");
  55.     System.out.println("*16 bit - charOne = " + charOne + "\t\t*");
  56.     System.out.println("*                               *");
  57.     System.out.println("*         other types           *");
  58.     System.out.println("*                               *");
  59.     System.out.println("*booleanOne = " + booleanOne + "\t\t*");
  60.     System.out.println("*stringOne = " + stringOne + "\t*");
  61.     System.out.println(one);
  62.     System.out.println(result);
  63.     System.out.println(number);
  64.     System.out.println(two);
  65.     System.out.println(wow);
  66.  
  67.    
  68.    
  69.    
  70.     System.out.println("The sum of my int's is " + addition);
  71.  
  72.     System.out.println("The sum of my doubles is " + plus);
  73.    
  74.  
  75.    }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement