Answered 4h 12m ago

The program uses a JLabel to hold a count label, a JTextField component to hold the number count, JButton component to create add, remove and reset buttons. When we click the add button, the count in the JTextField will get incremented by '1' and by clicking the remove button the count will be decremented by '1'. If we ... Read More

Answered 4h 49m ago

A JCheckBox is a component that can extend JToggleButton and an object of JCheckBox represents an option that can be checked or unchecked. If there are two or more options then any combination of these options can be selected at the same time. We can set a border to the JCheckBox component by using ... Read More

Answered 7h 55m ago

Modifying an array is just like modifying an object when that array is inside the object. The normal general principles will apply here.ExampleIn the following example, Initially in the 'companies' array, the first element is 'Tesla'. But after modifying the first element is changed to 'SolarCity' and the result is ... Read More

Answered 9h 2m ago

A JTextField is a subclass of JTextComponent class that allows the editing of a single line of text. We can implement the functionality of cut, copy and paste in a JTextField component by using cut(), copy() and paste() methods. These are pre-defined methods in a JTextFeild class.Syntaxpublic void cut() public void copy() public ... Read More

Answered 9h 16m ago

Looping through arrays inside objects is the same as looping through objects. We have to use 'for...in' loop to loop through arrays inside objects.ExampleIn the following example, an object "obj" is defined. This object has an array in it. Using 'for...in' loop, the elements in that array are displayed as ... Read More

Answered 9h 45m ago

A simple calculator is a calculator that performs some basic operations like ‘+’ , ‘-’ , ‘*’ , ‘/’. A calculator does basic operation in a fast way. We will use switch statement to make a calculator.SampleOperator − ‘+’ => 34 + 324 = 358 Operator − ‘-’ => 3874 ... Read More

Answered 9h 49m ago

Comma Operator in C/C++ programming language has two contexts −As a Separator −As an operator − The comma operator { , } is a binary operator that discards the first expression (after evaluation) and then use the value of the second expression. This operator has the least precedence.Consider the following ... Read More

Answered 9h 51m ago

The area of circumcircle of a right-angle triangle when the hypotenuse(H) of the triangle is given is found using the formula πH2/4.This formula is derived using the fact that the circumcircle touches all the corners of the triangle, in this case the maximum length between two points in the hypotheses ... Read More

Answered 9h 53m ago

The area of a circle inscribed inside an equilateral triangle is found using the mathematical formula πa2/12.Lets see how this formula is derived, Formula to find the radius of the inscribed circle = area of the triangle / semi-perimeter of triangle.Area of triangle of side a = (√3)a2/4Semi-perimeter of triangle ... Read More

Answered 9h 56m ago

Circle inscribed in a rhombus touches its four side a four ends. The side of rhombus is a tangent to the circle.Here, r is the radius that is to be found using a and, the diagonals whose values are given.Now the area of triangle AOB = ½ * OA * ... Read More

Answered 10h 3m ago

A circular sector also known as circle sector / sector of a circle is the portion of the circle that is inscribed by between 2 radii. This area is enclosed between two radii and an arc. To find the area inscribed we need to find the angle that is between ... Read More

Answered 10h 6m ago

The circle inscribed in a regular hexagon has 6 points touching the six sides of the regular hexagon.To find the area of inscribed circle we need to find the radius first. For the regular hexagon the radius is found using the formula, a(√3)/2.Now area of the circle inscribed is 3πa*a/4SampleSide ... Read More

Answered 10h 8m ago

The concept of triangular and square number, extended to a decagon gives the decagonal number. It a figurate number that is calculated using the mathematical formula (4n2 - 3n).Some Decagonal Numbers are 0, 1 , 10, 27, 52, 85, 126…ExampleThe 7th decagonal Number is 175By using formula (4*(7*7) - 3*7) ... Read More

Answered 10h 10m ago

To find the average of even numbers till a given even number, we will add all the even number till the given number and t count the number of even numbers. Then divide the sum by the number of even numbers.ExampleAverage of even numbers till 10 is 6 i.e.2 + ... Read More

Answered 10h 13m ago

The average of odd numbers till a given odd number is a simple concept. You just need to find odd numbers till that number then take their sum and divide by the number.If average of odd number till n is to be found. Then we will find odd numbers from ... Read More

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more