Found 7442 Articles for Java

Java Menu Driven Program to Perform Array Operation

Mr. Satyabrata
Updated on 27-Dec-2022 14:40:45

3K+ Views

Array in Java is called as a non primitive data type which stores a fixed number of single type values. It is called a One-dimensional array. In this article, we will see how to perform different array operations like checking duplicate elements, printing array in reverse order, checking largest element, checking smallest element, finding sum of all array elements by using Java Menu driven program. We will be implementing the application using a switch case. To show you some instances − Instance-1 Suppose we have created an array containing 6 elements and array elements are [2, 4, 6, 2, 6, ... Read More

Java Menu Driven Program to Determine Cost of New Membership

Mr. Satyabrata
Updated on 27-Dec-2022 14:38:24

354 Views

When we go anywhere for any type of membership they have different prices for different plans. For example silver membership, gold membership, diamond membership, platinum membership etc. where the silver membership costs less than others and platinum membership costs more than other plans. In this article we will see how to check the cost of a membership by using the Java programming language. We will be implementing the application using a switch case. To show you some instances  Instance-1 Suppose we have Rs 1840 as base membership price and you want to have a silver membership. The cost of silver ... Read More

Java Menu Driven Program to Check Type of a Number

Mr. Satyabrata
Updated on 27-Dec-2022 14:33:35

516 Views

In Java we have primitive numeric data types for numbers that are short, byte, int, long, float and double. These numeric data types allow us to represent different integer and real numbers based on their range as a specific data type has its lower and upper range. Below are the 6 primitive numeric data types  byte: Range -128 to 127 (Size 1 byte) short: Range -32, 768 to 32, 767 (Size 2 bytes) int: Range -2, 147, 483, 648 to 2, 147, 483, 647 (Size 4 bytes) long: Range -9, 223, 372, 036, 854, 775, 808 to 9, 223, 372, ... Read More

JAVA Menu Driven Program to Check Character is String, Number or Special Character

Mr. Satyabrata
Updated on 31-May-2024 14:47:53

12K+ Views

In this article, we will see a menu driven program to check if the entered character is number, string or special character by Java programming language. We will be implementing the application using a switch case. To show you some instances  Instance-1 Suppose the entered character is ‘a’ then the output should be “Entered character is a String”. Instance-2 Suppose the entered character is ‘1’ then the output should be “Entered character is a number”. Instance-3 Suppose the entered character is ‘$’ then the output should be “Entered character is a Special character”. Syntax To check whether ... Read More

Java menu driven program to check positive negative or odd even number

Mr. Satyabrata
Updated on 09-Aug-2024 23:59:26

2K+ Views

A number is said to be a positive number if it is greater than 0 and if it is less than 0 then it is called a negative number. The negative number is followed by a minus sign (-) to identify it as a negative number. A number is said to be an even number if it is divisible by 2 else it is called an odd number. In this article, we will see how to check if a number is positive, negative, or even, odd by using Java programming language. We will be implementing the application using a switch ... Read More

JAVA Program to Find Length of Longest Chord of a Circle

Mr. Satyabrata
Updated on 27-Dec-2022 14:24:38

171 Views

A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle. And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius. Chord of the circle refers to ... Read More

JAVA Program to Replace Each Element of Array with its Next Element

Shriansh Kumar
Updated on 11-Sep-2024 10:56:49

1K+ Views

As per the problem statement we have to write a Java program to replace each element of the array with its next element. In Java, the array is an object. It is a non-primitive data type which stores values of similar data types. Before discussing the solution for the given problem, let's understand the problem statement with an example − Example Scenario: Input: arr[] = {12, 23, 11, 64} Output: updated array = {23, 11, 64, 12} Algorithm Follow the steps below to replace each element of the array with its next element − Step 1 − Declare ... Read More

Find the Area of a Circle Inscribed in a Square in Java

Mr. Satyabrata
Updated on 27-Dec-2022 14:17:25

651 Views

A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle. And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius. A square consists of four sides ... Read More

JAVA Program To Convert Roman Number to Integer Number

Mr. Satyabrata
Updated on 27-Dec-2022 14:08:59

10K+ Views

Roman Number − Based on the ancient Roman system, symbols are used to represent the numbers. These numbers are known as Roman numbers. Symbols are I, V, X, L, C, D, and M use respectively for 1, 5, 10, 50, 100, 500, and 1, 000. Integer Number − Integer number is nothing but the whole number which consists ofpositive, negative and zero value. Fraction numbers are not integers. Here we have set the symbol values as per their integer values. Whenever a roman number is entered as input we divide into units and then calculate the appropriate roman number. I ... Read More

Check Whether a Number is an Autobiographical Number or Not in JAVA

Mr. Satyabrata
Updated on 27-Dec-2022 12:36:26

9K+ Views

A number is said to be an Autobiographical number, if the number’s first digit represents the number of 0 available in the given number, the second number represents the number of 1 present in the given number, the third number represents the number of 2 present in the given number and so on. In simple terms, if the given number’s digits from left to right represent the frequency of 0, 1, 2, 3, 4.... N respectively present in the given number then that number is known as Autobiographical number. Some examples of Autobiographical numbers are: 1210, 2020, 21200, 3211000, 42101000 ... Read More

Advertisements