Advertisement
jelanah24

JavaVariables

Apr 24th, 2017
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1.  
  2. package javavariables;
  3.  
  4. /**
  5. *
  6. * @author Autumn Francisco franciau@mail.uc.edu
  7. */
  8.  
  9.  
  10.  
  11.  
  12. public class Variables {
  13. public static void main(String []args) {
  14. /* Declaring variables for part 1
  15. */
  16. int intOperandA = 10;
  17. int intOperandB = 3;
  18. int intSum;
  19. int intProduct;
  20. int intDifference;
  21. int intQuotient;
  22. int intModulo;
  23.  
  24. double doubleOperandA = 22.2;
  25. double doubleOperandB = 11.1;
  26. double doubleSum;
  27. double doubleProduct;
  28. double doubleDifference;
  29. double doubleQuotient;
  30. double doubleModulo;
  31.  
  32. /* arithmetic*/
  33.  
  34. intSum = intOperandA + intOperandB;
  35. System.out.println("The sum of " + intOperandA + " and " + intOperandB+ " is " + intSum + ".");
  36.  
  37. intProduct = intOperandA * intOperandB;
  38. System.out.println("The product of " + intOperandA + " and " + intOperandB+ " is " + intProduct + ".");
  39.  
  40. intDifference = intOperandA / intOperandB;
  41. System.out.println("The difference between " + intOperandA + " and " + intOperandB+ " is " + intDifference + ".");
  42.  
  43. intModulo = intOperandA % intOperandB;
  44. System.out.println("The modulo of " + intOperandA + " and " + intOperandB+ " is " + intModulo + ".");
  45.  
  46.  
  47. doubleSum = doubleOperandA + doubleOperandB;
  48. System.out.println("The sum of " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleSum + ".");
  49.  
  50. doubleProduct = doubleOperandA * doubleOperandB;
  51. System.out.println("The product of " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleProduct + ".");
  52.  
  53. doubleDifference = doubleOperandA / doubleOperandB;
  54. System.out.println("The difference between " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleDifference + ".");
  55.  
  56. doubleModulo = doubleOperandA % doubleOperandB;
  57. System.out.println("The modulo of " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleModulo + ".");
  58.  
  59.  
  60.  
  61.  
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement