17 solutions available
Question 1Explain the significance of break statement in the switch statement.
Question 2Explain the significance of the default label in the switch statement.
Question 3Format the following if statements with indentation:i. if (x == y) if (x == z) x = 1; else y = 1; else z = 1;
Question 4Rewrite the following if statement, using the switch statement:if (choice == 0) System.out.println("You selected Blue"); else if (choice...
Question 5Write the following switch statement by using nested if statements:switch (choice) { case 0: case 1: x = 11; y = 22;...
Question 6Write an if statement to find the smallest of the three given integers using the min() method of the Math class.
Question 7Using the switch statement in Java, write a program to display the colour of the spectrum (VIBGYOR) according to the user's choice.
Question 8Employees at Arkenstone Consulting earn the basic hourly wage of Rs.500. In addition to this, they also receive a commission on the sales...
Question 9Write a program in Java to compute the perimeter and area of a triangle, with its three sides given as a, b, and c using the following...
Question 10Mayur Transport Company charges for parcels as per the following tariff:WeightChargesUpto 10 Kg.Rs. 30 per Kg.For the next 20 Kg.Rs. 20...
Question 11The electricity board charges the bill according to the number of units consumed and the rate as given below:Units ConsumedRate Per...
Question 12Write a menu driven program to accept a number from the user and check whether it is a Buzz number or an Automorphic number.i. Automorphic...
Question 13Write a program in Java to accept three numbers and check whether they are Pythagorean Triplet or not. The program must display the...
Question 14A cloth showroom has announced the following festival discounts on the purchase of items based on the total cost of the items...
Question 15A box of cookies can hold 24 cookies, and a container can hold 75 boxes of cookies. Write a program that prompts the user to enter the...
Question 16A special two-digit number is such that when the sum of its digits is added to the product of its digits, the result is equal to the...
Question 17Using the switch statement, write a menu driven program:To check and display whether a number input by the user is a composite number or...