Q2. in Each of the Following Statements What Is the Value of the Variable I ?

Q2. in Each of the Following Statements What Is the Value of the Variable I ?

<p> Kingdom of Saudi Arabia Ministry of Higher Education Al-Maarefa College for Science and Technology Faculty of Computer Science and Information Systems</p><p>(Tutorial (1</p><p>:Q1. For the following, mark illegal Identifiers and describe why they are illegal</p><p>Description Legal / illegal Identifier # Student .1</p><p>1stBook .2</p><p>Book1 .3</p><p>School fees .4</p><p>Class .5</p><p>My_Book .6</p><p>SchoolFeesAfterDiscount .7</p><p>? Q2. In each of the following statements what is the value of the variable I</p><p>;I = 4+2*3 .1</p><p>;I = 3 / 2 + 5.0 .2</p><p>;(I = 9 / (2+1 .3</p><p>;I = (4*6/2+8) % 2 .4</p><p>;I = 10/2 – 5 % 3 *4 .5</p><p>;I = 15.6 / 2 + 5 .6</p><p>;I = 4 * 3 + 7 / 5 - 25.5 .7 ;I = (int) 4.6 + 3/2 .8</p><p>;(I = (int) (4.6 + 3/2 .9</p><p>.Q3. Write a java code that prints your name</p><p>.Q4. Trace the following java codes then write the output 1 } public class salary</p><p>(public static void main (String [] args } ;final int WEEK_DAYS =7</p><p>;double SalaryPerHour =100, WeeklySalary, deduction</p><p>;int WorkingHours =8</p><p>;deduction= SalaryPerHour*3</p><p>;deduction+=40</p><p>WeeklySalary = SalaryPerHour * WorkingHours * WEEK_DAYS - ;deduction</p><p>System.out.println("employee salary is "+SalaryPerHour+" * ;( "+WorkingHours+" * "+WEEK_DAYS+" - "+deduction+" = "+WeeklySalary</p><p>{ { 2 } public class FahrenheitToCelsius</p><p>} (public static void main(String[] args</p><p>;double celsius, fahrenheit</p><p>;fahrenheit = 10.00</p><p>;celsius = (fahrenheit-32)*5/9</p><p>System.out.println("The amount of Fahrenheit is equal to \n \"" + celsius ;(" "\.+ " degrees Celsius { { :Q5.Write a program that prints the following banner</p><p>AAA VV VV AAA JJJJJJJJJJJJ AA AA VV VV AA AA JJ AA AA VV VV AA AA JJ AAAAAAAAA VV VV AAAAAAAA JJ AA AA VV VV AA AA JJ JJ AA AA VVV AA AA JJJJJJ </p><p>. Q6. Write a program that calculates the average of two integers then print the result</p><p>: Q7. Find the error in the following codes 1</p><p> public class ProgWithErrorsA } ;static final int SECRET_NUM = 11,213 ;static final double PAY_RATE = 18.35 (public void main(String[] arg } ;int one, two ;double first, second ;one = 18 ;two = 11 ;first = 25 ;second = first * three ;second = 2 * SECRET_NUM ;SECRET_NUM = SECRET_NUM + 3 ;(System.out.println(first + " " + second + " " + SECRET_NUM paycheck = hoursWorked * PAY_RATE ;(System.out.println("Wages = " paycheck { {</p><p>2</p><p> public class ProgWithErrorsA } '*' = static final char = STAR ;static final int PRIME = 71 (public static void main(String[] arg } ;count = 1 ;sum = count + PRIME ;x := 25.67 ;newNum = count * ONE + 2 ;sum + count = sum ;x = x + sum * COUNT " = System.out.println(" count = " + count + ", sum ;(sum + ", PRIME = " + Prime + { {</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us