1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
prisoha [69]
3 years ago
10

Java !!!

Computers and Technology
1 answer:
coldgirl [10]3 years ago
7 0

Answer:

Explanation:

import java.util.*;

public class BalancedBrackets {

// function to check if brackets are balanced

static boolean isBalanced(String expr)

{

Stack<Character> stack = new Stack<Character>();

for (int i = 0; i < expr.length(); i++)

{

char x = expr.charAt(i);

if (x == '(' || x == '[' || x == '{')

{

// Push the element in the stack

stack.push(x);

continue;

}

if (stack.isEmpty())

return false;

char check;

switch (x) {

case ')':

check = stack.pop();

if (check == '{' || check == '[')

return false;

break;

case '}':

check = stack.pop();

if (check == '(' || check == '[')

return false;

break;

case ']':

check = stack.pop();

if (check == '(' || check == '{')

return false;

break;

}

}

// Check Empty Stack

return (stack.isEmpty());

}

public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);

System.out.println("\nEnter the expression to check is balanced or not !");

String expr = scan.nextLine();

boolean output;

output = isBalanced(expr);

System.out.println(output);

if (output)

System.out.println("Balanced ");

else

System.out.println("Not Balanced ");

scan.close();

}

}

You might be interested in
2.2 Write an interactive C# program that asks the user to input an integer number. The program checks whether the number entered
AlexFokin [52]

Answer:

I need some time i answering your question please follow me and thanks

6 0
3 years ago
A. Calculate the diffusion coefficient for magnesium in aluminum at 450°C.
SIZIF [17.4K]

Answer:

a) D = 4.88 * 10^(-14) m^2 / s

b)   <em>t </em>= 1.1 hr

Solution:

a) Magnesium in Aluminum diffusion:

D = Do * exp(-Qd / RT)

  =  (1.2 * 10^(-4) m^2 / s) * exp ( - 130,000 / 8.31 * 723.15)

  = 4.88 * 10^(-14) m^2 / s

D = 4.88 * 10^(-14) m^2 / s

b) The composition remains same at say the distance Xo:

(Cx - Co) / (Cs - Co) = Constant

Xo^2 / D_{550} * <em>t </em>= Xo^2 / D_{450} * 15

D_{550} * <em>t </em>= D_{450} * 15

(1.2 * 10^(-4) m^2 / s) * exp ( - 130,000 / 8.31 * 723.15) * <em>t</em>

(4.88 * 10^(-14) m^2 / s) * 15

by, solving for <em>t </em>we get:

 <em>t </em>= 1.1 hr

So, the time required is 1.1 hr.

5 0
2 years ago
When you take action independent of direct instruction, you are showing _____.
ozzi

Answer:

Option A, initiative

Explanation:

Initiation is an art of performing an act or task by self motivation rather on command or instruction from anyone.

Insubordination is incorrect as here there is no mentioning of disobeying seniors or authority

Also, courage and power means having strength to perform any task. Here action is performed without any instruction and it in no sense signifies a brave deed.

Hence, option A is correct

8 0
3 years ago
In what form do the hexadecimal numbers need to be converted for a computer’s digital circuit to process them?
MrMuchimi

Hexadecimal numbers are just a convenient representation of binary data. When entered as text, they consist of ASCII characters 0-9 and a-f. The numbers will then have to be converted to binary. This is accomplished by converting to uppercase, subtracting the ASCII offset (48 for 0-9 or 55 for A-F), so that the result is a number between 0 and 15 (inclusive). This can be stored in computer memory to represent 4 bits.

Hexadecimal numbers represent binary numbers in the following way:

hex | binary

0 = 0000

1 = 0001

2 = 0010

3 = 0011

4 = 0100

5 = 0101

6 = 0110

7 = 0111

8 = 1000

9 = 1001

a = 1010

b = 1011

c = 1100

d = 1101

e = 1110

f = 1111

As you can see, no other 4 bit combination exists.



5 0
3 years ago
What is the limitation of computer<br>​
eimsori [14]

The limitation of computer are:

  1. No self-intelligence
  2. No feeling
  3. No learning power
  4. Dependency

3 0
3 years ago
Other questions:
  • Why is the answer A?
    6·1 answer
  • Security awareness training can reduce the risk of a data breach by what percentage?
    12·1 answer
  • The internet connects millions of computers connected through millions of ____ worldwide.
    9·1 answer
  • Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata to writ
    6·1 answer
  • Explain briefly the purpose of the Computer Management Console in Microsoft Windows.
    12·1 answer
  • Repl.it Assignment 4.1.2 (Guess the Number)<br> Please help me<br> I will give brainliest and a like
    10·1 answer
  • Why won't Brainly let me send a link? This is just du*mb! I want to send good articles explaining a content, and this site just
    5·1 answer
  • 3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
    15·2 answers
  • Features of Python are *
    9·1 answer
  • Software piracy is acceptable as it helps us obtain software cheaper or sometimes even for free.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!