Write a program in Java using a class with the following specifications- Class name: SortThis Java program defines a class Sort that sorts an array of 10 integers in ascending order using the Bubble Sort technique. It includes methods to input data, sort the array, and display the sorted array. Read more
Class name: Sort Data members/instant variables: int i, j, temp, k void array( ): to arrange the numbers in ascending order void outputdata( ): to display the array elements in ascending order. |
||||||||||
Write a class program in Java to use an integer array of 10 numbers as instant variables.This Java program defines a class Array_max to handle an array of 10 integers. It provides methods to input numbers, find the maximum value, and display the result. Read more
Class name: Array_max Data members: void findmax( ): to find the maximum among the list of array elements. void outputdata( ): to display maximum among the list of the elements. |
||||||||||
A dice game is played between two players.This Java program simulates a dice game between two players. Each player rolls a dice until their score reaches 20. The winner is the player with the minimum number of throws. Read more
Data Members: To display details of the result. To compute the result depending on the number of throws. |
||||||||||
Encryptology is the process of encoding a string to another form in such a way that it should not be known to unauthorized person.This Java program defines an Encode class to encrypt a string using character shifting based on a move value. It supports positive, negative, and zero moves, with proper wrapping of characters within the alphabet. Read more
You must keep in mind that the characters are wrapped around while encryption i.e., Z is followed by A and A is followed by Z considering the moves to be negative and positive respectively. ABZ can be encrypted as YZX if move = -2 ABZ can be encrypted as ABZ if move = 0 Data members/Instant variables: void perform(int move): To perform encryption at a defined move void display( ): To display the encrypted string. |
||||||||||
Data members/instant variables: s: String type t1, t1: Integer countersThis Java program defines a Count class to count words starting with uppercase and lowercase characters in a string. It uses string splitting, character classification, and counter updates for processing. Read more
Class name: count Data members/instant variables: t1, t1: Integer counters void countwords( ): To count the number of words starting with upper case and lower case characters. void display( ): To print the counter values. |
||||||||||
Write a program in Java by using a class with the following specifications: Class name: operateThis Java program defines an Operate class to analyze a string for letters, digits, white spaces, upper and lower case letters, and combined counts. It demonstrates string traversal and character classification. Read more
Class name: operate Data members/instant variables: void checkpoint( ): To check and print the following: a) Number of Letters |
||||||||||
Sponge Iron Company announces an increment of their employee based on seniority basic as per the given conditions:This Java program defines an Increment class to calculate an employee's updated basic pay based on age and company rules. It demonstrates input handling, conditional calculations, and formatted output. Read more
Read Answer
Class: Increment Data members/Instant variables: double basic: Basic pay of the employee int age: Age of the employee void calculate( ): To find increment and update basic. void display( ): To display age and updated basic in the format given Name Age Updated Basic xxxxxxx xxxxxxx xxxxxxx |
|
Age |
Increment |
|
56 years and above |
20% of basic |
|
Above 45 and below 56 years |
15% of basic |
|
Up to 45 |
10% of basic |
This Java program defines a Security class to calculate an employee's wages based on the number of hours worked and predefined conditions. It demonstrates input validation, wage computation, and formatted output.
Read more|
Number of hours |
Rate |
|
Up to 40 hrs. |
Rs. r per hour |
|
For next 20 hrs. |
Rs. 1.5r per hour |
|
For next 20 hrs. |
Rs. 2r per hour |
Read Answer
This Java program defines a Salary class to manage teacher details, including calculating the annual income tax based on a monthly salary exceeding Rs. 1,75,000. It demonstrates object-oriented programming concepts with input, computation, and display functionalities.
Read moreRead Answer
This Java program defines a Rectangle class with methods to input dimensions, calculate area, perimeter, and diagonal, and display the results. It demonstrates object-oriented programming concepts.
Read moreThis Java program demonstrates function overloading with the compare() method. The method is overloaded to compare two integers, two characters (based on ASCII values), and two strings (based on length). Depending on the input type, it prints the greater value or the longer string.
Read moreRead Answer
This Java program demonstrates function overloading with the manip() method to perform two tasks: (1) display characters at even or odd positions in a string based on user input, and (2) compute the square or cube root of an integer based on a given character argument.
Read moreRead Answer
This Java program allows the user to convert a decimal number to binary and a binary number to decimal using a menu-driven interface. The program provides options to convert a number based on user input, with error handling for invalid binary numbers.
Read moreRead Answer
This Java program takes 10 numbers as input, stores them in an array, and then searches for a specified number in the array. If the number is found, it displays "Number is present", otherwise "Number is not present".
Read moreThis Java program calculates the Lowest Common Multiple (LCM) of two integers using the Greatest Common Divisor (GCD). The GCD is found using the continued division method, and the LCM is then calculated using the formula: LCM = (a * b) / GCD(a, b).
Read moreLCM
= Product of two numbers/GCD
This Java program demonstrates function overloading by defining two calculate methods. The first method checks if an integer is divisible by 7 or if its last digit is 7, while the second method compares two integers and displays the greater or smaller based on a character argument.
Read moreRead Answer
This Java program demonstrates function overloading by defining two display methods. One method displays uppercase or lowercase characters based on an integer parameter, and the other displays vowels or all alphabets based on a character parameter.
Read moreRead Answer
This Java program takes a string input from the user and displays the first character of each word in the string, printing each character on a new line.
Read moreRead Answer
This Java program calculates the income tax for an employee based on their annual income using specific tax slabs. It displays the employee's name and the computed income tax according to the given tariff.
Read more|
Annual
Income |
Income
Tax |
|
Up to Rs. 50000 |
No tax |
|
Rs. 50001 to Rs. 100000 |
10% of the income exceeding Rs. 50000 |
|
Rs. 100001 to Rs. 150000 |
Rs. 5000+ 20% of the amount exceeding Rs. 100000 |
|
Rs. 150001 and above |
Rs. 15000 + 30% of the amount exceeding Rs. 150000 |
This Java program accepts a string from the user and displays the first character of each word after changing its case (lowercase to uppercase and vice versa). Each character is printed on a new line.
Read moreRead Answer