Second Assignment Class IX
Second Assignment Class IX
Computer Application
___________________________________________________________________________________
Q1- Find the errors in the following program segments and write it correctly :
(a) a?(a==b) : b ;
(b) if x=!y+30
System.out.print(x);
else
System.out.print(x);
else
x++;
Q2-Rewrite each of the following program segment using more than one if construct :
(a) if(percent>80)&&percent<=90)
count+=1;
(b) if(totMarks>250 && engMarks>80 && mathMarks>95)
eligibility=Y ;
else
eligibility=N ;
(c) if(number%2==0 && number>50 && number<100)
{
c=c+1;
number=number/c;
rem=number%10;
}
Q3- Write a program to take a number form the user as parameter and find the given number is even or
odd .
Q4-Write a program to input temperature in Fahrenheit as a parameter, convert and display the given
temperature in Celsius .
Q5- A cloth showroom has announced the following festival discounts on purchase of items .
Amount of purchase
Discount in % Mill Cloth
Discount in % Handloom items
Less than Rs. 1000
2%
5%
Rs. 1000 to Rs. 5000
20%
25%
Rs. 5001 to Rs. 10000
40%
50%
Above 10000
50%
60%
Write a java program to compute the net amount paid by the customer .Assume all required values to
be inputted by the user .Make use of if Structure . total purchase amount take input as parameter.
Q6- WAP to compute the amount that a customer pays for the taxi that has hires based on the following
condition :
Kms travelled
Amount per km in Rs.
First 10 kms
25
Next 20 kms
10
Next 40 kms
15
Above 70 kms
12
Input the customers name , the taxi number and the number of kilometers travelled by him .And print
Name ,Taxi number ,kilometer ,Total amount customer has to pay.
ACME Academy-Issue on Date 24-May-2013: Date of submission 8 July-2013
Page 1