Lab Assessment: Code Script-Text Format
Lab Assessment: Code Script-Text Format
Lab Assessment: Code Script-Text Format
Question 1:
Code script-text format:
import java.util.*;
public class Salary
{
public static void main(String args[])
{
double basicSalary;
double gross;
double da;
double hra;
if(basicSalary<10000)
{
da=basicSalary*0.8;
hra=basicSalary*0.2;
System.out.println("DA is " +da);
System.out.println("HRA is " +hra);
}
}
}
Code Screen Shot format:
Output:
Question 2:
Code script-text format:
import java.util.*;
class Arrays
{
public static int get(int[] array, int num)
{
for(int i = 0; i < array.length; i++)
{
if(array[i] == num)
{
return(i);
}
}
return(-1);
}
}
}
Code Screen Shot format:
Output:
Question 3:
Code script-text format: