Write a program, to show the behavior of ‘try / catch block and finally’. In this, write a suitable
program to check the following scenario.
‘Allow the user to input two numbers. Divide the first number entered by the second number and
display the answer. In case, if the user enters the second number as ‘0’, program may generate a run
time exception.
Arjun wants to count total number of digits of an Integer number (N). Help him to generate the program using do while loop.
As a safety precaution banks provide a feature that during any ATM transaction if someone comes and attacks, then the customer can enter the ATM pin in reverse order. This sends a message to the nearest police station. However if the reversed pin is the same as he original pin then no alarm is created. The bank needs a software application that checks that a user chooses an ATM pin whose reverse is not the same number. A software need to be developed with following requirements using while loop.
a. Read the pin number
b. Calculate the reverse the pin number
c. if the reversed pin is same as original pin then inform the user that this is an invalid pin number
In a box of total area 10000cm3, Mr. Varun has to pack the balls of given radius “r” and all the balls have the same volume, Help Mr. Varun to find the total number of balls that he can pack in the given box.
Requirements
Capture the radius of the ball “r”
Compute the volume (Hint: Volume=4/3πr3)
Calculate how many number of balls can be placed in the box of 10000cm3 box
Display the number of balls packed by Mr. Varun
As many of the students like chats, chips, juice and chocolates, a vending machine is kept at several places. The person after putting the cash has to enter the product code so as to get it.
The code is as follows
Code Product
106 Haldiram Ratmali Sev
206 Haldiram Instant Bhel
306 Fuse Chocolate
406 Mixed Fruit Juice
506 Lassi
Depending on the code entered the item will be selected and given to the person who feeds the amount.An application has to be developed so that it automatically works after entering the code.
Requirements:
1. Capture the Code
2. Check the code with the existing code and display appropriate product selected
3. If the code is entered wrong it has to display money lost
Peter runs a vehicle rental center. The vehicles are of three types, MICRO, MINI and SUV. The customer who travels in MICRO will pay Rs 15 per kilometer. The customer who travels in MINI will pay Rs 20 per kilometer and the customer who travels in SUV will pay Rs 25 per kilometer.
A software need to be developed to compute the cost of travelling by the customer with following requirements.
a. The distance travelled by customer need to be captured.
b. The type of vehicle to be captured (M for Micro, m for mini, S for SUV).
c. Check the type of vehicle.
d. Compute the final cost of the travel depending on the vehicle.
Display the final cost.
Write a program, to show the behavior of ‘try / catch block and finally’. In this, write a suitable
program to check the following scenario.
‘Allow the user to input two numbers. Divide the first number entered by the second number and
display the answer. In case, if the user enters the second number as ‘0’, program may generate a run
time exception.’
Write a Java program to create a text file named ‘File1.txt.’ Write your Index Number and batch
name in two separate lines in the above file. Read the file and display the content of the text file.
Write a program to illustrate creation of threads using extending a Thread class. (start method start
each of the newly created thread. Inside the run method there is sleep() for suspend the thread for
500 milliseconds. Write the method to display your Index No 5 times using a loop as follows).
write a program in c to add two polynomials with n number of variables