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
WRITE A PROGRAM TO CALCULATE SIMPLE INTEREST
Alchen [17]

The simple interset program is a sequential program, and does not require loops and conditions

The simple interset program in Python, where comments are used to explain each line is as follows:

#This gets input for the principal amount

P = int(input("P = "))

#This gets input for the rate

R = int(input("R = "))

#This gets input for the number of years

N = int(input("N = "))

#This calculates the simple interest

I = P * R * T * 0.01

#This prints the simple interest

print("Simple Interest =",I)

Read more about simple interest at:

brainly.com/question/2294792

7 0
2 years ago
Plato :
ddd [48]

Answer:

filler content

Explanation:

Isabel must use some sort of filler content while creating a wireframe that she is up with. For the banner, she can make use of the placeholder, and for the text, she can make use of the lorem ipsum. Also, if the wireframe is low fidelity then only she can use above. And if the wireframe is high fidelity then she should use the original banner and text.

3 0
3 years ago
Read 2 more answers
Make the list of menu icon in MS Excel<br>​
valina [46]

●file

●home

●insert

●page layout

●formulas

●data

●review

●view

8 0
2 years ago
What is company NDR?​
lina2011 [118]

Answer:

Explanation:

NDR is a multinational American based company with international branches in Thailand, Cambodia, and Myanmar in the telecom industry and media with sales of over US$100 Million. The company develops application store (APP Store) and application (APP) for mobile devices with 700,000+ apps in the app store.

7 0
3 years ago
2.<br> The force of impact is
NNADVOKAT [17]

Answer:

lực ( Tiếng Anh : force ) là bất kỳ ảnh hưởng nào làm một vật thể chịu sự thay đổi, hoặc là ảnh hưởng đến chuyển động, hướng của nó hay cấu trúc hình học của nó.

Explanation:

7 0
3 years ago
Other questions:
  • A ____ is a prewritten formula that is built into excel.
    6·1 answer
  • Solar power plants trap the sun’s energy and convert it into electricity. What is a problem associated with this technology?
    11·1 answer
  • Your friend Kayla is starting her own business and asks you whether she should set it up as a P2P network or as a client-server
    13·1 answer
  • Prompt the user ‘Enter a row vector of any numbers’ in the command window, and enter an arbitrary row vector and store it to x.
    6·1 answer
  • Do AirPods Pro have a green flashing light when charging?
    11·2 answers
  • The right headlight does not function on either high or low beam. Technician A says this could be caused by an open ground on th
    12·1 answer
  • Who ever likes Pokemon an wants to help me please comment and I will Give the room for My Assignment
    9·1 answer
  • A computer's hard disk drive holds 8 x 10^10 bytes of information. If Jill buys an extra memory stick that holds 5.1 X 10^8 byte
    10·1 answer
  • Implementing an interface means that you are adding to your class any mechanisms defined in an abstract class. Your class essent
    12·1 answer
  • When did time begin?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!