Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignments Assignment2 Note: The answers to the following questions should be t

ID: 3786628 • Letter: A

Question

Assignments Assignment2 Note: The answers to the following questions should be typed in the block of comments in the Assignment2j file. Please make sure theyre commented out Type them neatly and make them easy to read for the graders. Exercisel: What output is Produced by the following statement? po System out. Print 25 plus 20 is 25 20) Evereise2: What value is contained in the integer variable size after the following statement ts are executed? Pt) 16 size 6 size size. size Exercive3: Given the fonowing declarations, what result is stored in each of the listed assignment statementsewhat is the value.fiResultor Resuly? (1pecach) 15, num2 int iResult 2.0, val2- 12.68 double fResult, val1 Results num1/valli Result fRelault. num (float num2 f Result e) fResult (float) Inumi num2) write a complete Java program in a source file to be named Assignment2iava MacBook Air

Explanation / Answer

I am uploading part-1 of assignment. Do save the file as Assignment2.java as mentioned.

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
   public static void main (String[] args) throws java.lang.Exception
   {
       // your code goes here
       System.out.println(" 25 plus 20 is "+ 25 + 20);
       //exercise 1: 25 plus 20 is 2520
      
       int size = 16;
       size = size + 6;
       size = size * 3;
       size = size / 4;
       //exercise 2: size value is 16
      
       //exercise-3:
       int iResult, num1 = 15, num2 = 2;
       double fResult, val1 = 2.0, val2 = 12.68;
       iResult = num1/num2;            //a: 7
       fResult = num1/val1;            //b: 7.5
       fResult = num2/val2;            //c: 0.15772870662460567
       fResult = num1 / (float) num2; //d: 7.5
       fResult = (float)(num1/num2);   //e: 7.0
   }
}

Link to the code: http://ideone.com/pD08Mf

Hope it helps, do give your response.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote