Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javavariables;
- /**
- *
- * @author Autumn Francisco franciau@mail.uc.edu
- */
- public class Variables {
- public static void main(String []args) {
- /* Declaring variables for part 1
- */
- int intOperandA = 10;
- int intOperandB = 3;
- int intSum;
- int intProduct;
- int intDifference;
- int intQuotient;
- int intModulo;
- double doubleOperandA = 22.2;
- double doubleOperandB = 11.1;
- double doubleSum;
- double doubleProduct;
- double doubleDifference;
- double doubleQuotient;
- double doubleModulo;
- /* arithmetic*/
- intSum = intOperandA + intOperandB;
- System.out.println("The sum of " + intOperandA + " and " + intOperandB+ " is " + intSum + ".");
- intProduct = intOperandA * intOperandB;
- System.out.println("The product of " + intOperandA + " and " + intOperandB+ " is " + intProduct + ".");
- intDifference = intOperandA / intOperandB;
- System.out.println("The difference between " + intOperandA + " and " + intOperandB+ " is " + intDifference + ".");
- intModulo = intOperandA % intOperandB;
- System.out.println("The modulo of " + intOperandA + " and " + intOperandB+ " is " + intModulo + ".");
- doubleSum = doubleOperandA + doubleOperandB;
- System.out.println("The sum of " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleSum + ".");
- doubleProduct = doubleOperandA * doubleOperandB;
- System.out.println("The product of " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleProduct + ".");
- doubleDifference = doubleOperandA / doubleOperandB;
- System.out.println("The difference between " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleDifference + ".");
- doubleModulo = doubleOperandA % doubleOperandB;
- System.out.println("The modulo of " + doubleOperandA + " and " + doubleOperandB+ " is " + doubleModulo + ".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement