• Exercise 2
     
    • Create program that solves following calculations:

      • 1. a * b
    • 2. a / b
    • 3. a / b * c
    • int a = 12, b = 32, c = -23
       
    • Tasks 2 and 3 results have to be floating numbers, so that result will not be 0.
      For this use typecast –operator :
       
      • a = (type)b;
         
    • Example:
       
      • double da = 5.67;
      • int ia = (int)da;
      • System.out.println( ia );
         
    • Example of solution
    • Hints:
      • Java Tutorial / Learning the Java Language / Language Basics
        especially Varibles & Operators
         
  • Back