Write a menu-driven program using a method Number ( ) to perform the following tasks:This Java program allows the user to check if a number is a Buzz number or a Composite number through a menu-driven interface. The user can select an option and enter a number to perform the desired check. Read more
a) Accept a number from the user and check whether it is a ‘BUZZ’ number or not. A Buzz number is the number which either ends with 7 is or divisible by 7. |
||||||||
Write a class with the name volume using function overloading that computers the volume of a cube, a sphere and a cuboid.This Java program defines a class Volume with overloaded methods to calculate the volumes of a cube, sphere, and cuboid. The program accepts user input and calculates the corresponding volumes. Read more
|
||||||||
Write a program in Java to interchange the value (swap) of the two numbers a and b and display the result after swapping.This Java program uses overloaded methods to swap integer and float values separately, displaying the result before and after the swap. Read more
Read Answer
Write
a program in Java to interchange the value (swap) of the two numbers a and b
and display the result after swapping.
|
||||||||
Write a program to find the sum of the given series to n terms by using the function name sum (int).This Java program calculates the sum of the series (1*2) + (2*3) + (3*4) + ... up to n terms using the function sum(int n) and displays the result. Read more
|
||||||||
Write a program in Java to accept a word and pass the word to a function named Void display (String a).This Java program accepts a word and uses a function display to find and display all the vowels (a, e, i, o, u) present in the word. Read more
The vowels are: o e |
||||||||
Write a program to calculate the monthly electricity bill of a consumer according to the units consumed.This program calculates and displays the monthly electricity bill of a consumer based on units consumed and specified tariff rates. It uses a function cal(int u) to compute the bill and outputs the details in a formatted manner. Read more
|
|
Units Consumed |
Charge |
|
Up to 100 units |
Rs. 1.25 per unit |
|
For the next 100 units |
Rs. 1.50 per unit |
|
More than 200 units |
Rs. 1.80 per unit |
Unit consumed = Present reading – Previous reading
Read Answer
This Java program determines if two numbers are twin primes. It uses a function prime(int n) to verify if numbers are prime and checks if the difference between the two numbers is exactly 2.
Read moreRead Answer
This Java program checks if a number is Automorphic using a function digits(int n) to calculate the number of digits. It determines if the original number matches the last digits of its square.
Read moreAn
automorphic number is the number that is contained in the last digit (s) of
its square. Write a program in Java to accept a number and check whether it is
an Automorphic number or not, using function name digits (int n) which returns the number of digits present in the number. For example, 25 is an automorphic number, with a square of 625, and 25 is present as the last two digits.
This Java program checks if a number is a palindrome using a reverse(int n) function that returns the reversed number. It compares the original number with its reversed form.
Read moreThis Java program determines if a number is prime using a function check(int n) that returns 1 for prime and 0 otherwise. The user inputs a number, and the program outputs whether it is prime.
Read moreWrite
a program in Java to accept a number and check whether the number is prime or
not using the function name check (int n). The function returns 1 if the number
is prime otherwise 0.
This Java program calculates the compound interest and amount based on user input for principal, rate, and time. The calculation continues until the user enters an alphabet, after which the program terminates.
Read moreRead Answer
This Java program accepts a word in uppercase, and for each letter, it displays its position in the alphabet, where 'A' is 1, 'B' is 2, and so on.
Read moreRead Answer
This Java program replaces specific words in a predefined sentence using the replace() method and displays the modified sentence.
Read moreRead Answer
This Java program accepts a string input and forms a new string by concatenating the first character of each word in the input string.
Read moreRead Answer
This Java program takes a string input, identifies the words that begin with a capital letter and end with a small letter, and prints those words.
Read moreRead Answer
This Java program accepts a string from the user and removes all occurrences of the token "THE" except the first one. The new string is then displayed.
Read moreRead Answer
This Java program accepts a sentence, identifies the palindrome words, and displays them.
Read moreRead Answer
This Java program accepts a set of positive and negative numbers, then prints the negative numbers first while keeping their original order, followed by the positive numbers.
Read moreThis Java program accepts a set of positive and negative numbers, then prints the negative numbers first while keeping their original order, followed by the positive numbers.
Read moreRead Answer
This Java program takes a sentence as input, calculates the sum of ASCII values of the characters for each word in the sentence, and displays the word along with the corresponding sum.
Read moreWrite a program by using the scanner class to input a sentence. Print each word of the sentence along with the sum of ASCII codes of its character.