Page 150 - CA_Blue( J )_Class10
P. 150
14. An electronics shop has announced the following seasonal discounts on the purchase of certain items:
Purchase amount in Rs. Discount on Laptop Discount on Desktop PC
0 – 25000 0.0% 5.0%
25001 – 57000 5.0% 7.6%
57001 – 100000 7.5% 10%
More than 100000 10.0% 15.0%
Write a program based on the above criteria to input the name, address, amount of purchase and the type of purchase (L for
Laptop and D for Desktop) by a customer. Compute and print the net amount to be paid by a customer along with his name and
address.
[Hint: Discount = (discount rate / 100) * amount of purchase, Net amount = amount of purchase - discount]
15. Write a menu-driven program to convert a given temperature from Fahrenheit to Celsius and vice-versa using the switch
statement. For an incorrect choice, an appropriate error message should be displayed.
5
[Note: C = (F - 32) × 9 and F = 1.8 × C + 32]
16. Write a menu-driven class to accept a number from the user and check whether it is a palindrome or a perfect number.
(a) Palindrome number - a number is a palindrome that when read in reverse order is the same as read in the right order.
Example: 11, 101, 151, etc.
(b) Perfect number - a number is called perfect if it is equal to the sum of its factors other than the number itself.
Example: 6 = 1 + 2 + 3.
17. Write a menu-driven program to accept a number from the user and check whether it is a BUZZ number or to accept any two
numbers and print the GCD of them.
(a) A BUZZ number is the number that either ends with 7 or is divisible by 7.
(b) GCD (Greatest Common Divisor) of two integers is calculated by the continued division method. Divide the larger number by
the smaller; the remainder then divides the previous divisor. The process is repeated until the remainder is zero. The divisor
then results in the GCD.
D. Assertion and Reasoning based questions.
The following questions consist of two statements – Assertion (A) and Reason (R). Answer these questions by selecting the
appropriate option given below:
a. Both A and R are true, and R is the correct explanation of A.
b. Both A and R are true, but R is not the correct explanation of A.
c. A is true, but R is false.
d. A is false, but R is true.
1. Assertion (A): In Java, the && operator is used for logical AND and evaluates the second operand only if the first operand is true.
Reason (R): The && operator is known as a short-circuit operator because it can skip the evaluation of the second operand.
2. Assertion (A): The default case in a switch statement is executed only if none of the case labels match the switch expression.
Reason (R): The default case in a switch statement must be the last case in the block.
21 st
E. Case-based questions. Century #Experiential Learning
Skills
1. Joy is developing a traffic light system simulation. The traffic light can be red, yellow, or green. The actions based on the traffic light
color are as follows:
- If the light is red, print "Stop".
- If the light is yellow, print "Ready".
- If the light is green, print "Go".
Joy writes the following code to implement these rules:
String lightColor = "green";
switch (lightColor) {
case "red":
System.out.println("Stop");
break;
148148 Touchpad Computer Applications-X

