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
What are "open-loop" and "closed-loop" systems
frozen [14]

open loop is by the fact that the output signal or condition is neither measured nor “fed back” for comparison with the input signal or system set point. Closed-loop an automatic control system in which an operation, process, or mechanism is regulated by feedback.


6 0
3 years ago
Explain the limitations of the old economy<br>​
pickupchik [31]

Explanation:

Time Constraint and Time Consuming: Nobody would carry out business when the market was closed. ... Limited Space: The old economy depended on physical space such as market places and offices before business transaction could take place.

7 0
3 years ago
Recent advances in information technologies (IT) have powered the merger of online and offline retail channels into one single p
zmey [24]

Answer:

True

Explanation:

With the recent advancement in IT we have witnessed offline retail businesses begin to get online presence. The advancement of the e-commerce sector and the convenience that it brings to customers through providing the ability to make orders online and get goods delivered to their doorsteps in a short time, has brought about escalating growth in the online and in extension offline retail businesses.

Big retail chains such as Walmart are taking advantage of this to increase their sales. Also, online retail presence helps put offline businesses out there in terms of advertising and marketing.

3 0
3 years ago
Weekly salary and assumes work-hours-per-week limit of 40. Overtime refers to hours worked per week in excess of some weekly lim
hodyreva [135]

Answer:

import java.util.Scanner;

public class WeeklySalary {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter Hourly wage");

       double hourlyWage = in.nextDouble();

       System.out.println("Enter total hours worked in the week");

       int hoursWorked = in.nextInt();

       int overtime = hoursWorked - 40;

       double weeklyWage = 40*hourlyWage;

       System.out.println("Total Over Time Hours is: "+overtime);

       double overTimeWage = overtime*(hourlyWage*1.5);

       System.out.println("Wage for full time: "+ weeklyWage);

       System.out.println("Wage for over time: "+ overTimeWage);

   }

}

Explanation:

  • Using Java programming language
  • Import the Scanner class to receive user input
  • prompt user for hourly wage rate, receive and save in a variable
  • Prompt user for total hours worked for the week receive and save in a variable
  • calculate overtime hours by subtracting 4 from total hours worked in the week
  • Calculate weekly wage by multiplying hourly rate by 40
  • Calculate overtime by multiplying overtime hours by (hourlyWage*1.5).
  • See attached sample run of the code

8 0
3 years ago
var shirt = "blue"; 2. var pants = "gray"; 3. var clothes = wearIt(shirt, pants); 4. function wearIt( x, y) 5. { 6. var myOutfit
pogonyaev

Answer:

Arguments: "blue" and "gray"

Parameters: x and y

Explanation:

In programming, a function can take zero or one or more than one input values. These input value will be held by the variables which are called parameters. In this code snippet, x and y are parameters of wearIt function.

On another hand, when calling a function, we provide the values to the function and the values provided are termed as arguments. In this case, we provide the string blue and gray which are held by shirt and pants variables respectively to the function wearIt. The string "blue" and "gray" will then be passed to parameter x and y which will be processed in the function.  

4 0
4 years ago
Other questions:
  • Slmething about device for defrosting windscreen?
    5·1 answer
  • If Nancy receives an encrypted message from Matthew, which key does she use to read it? Nancy’s private key Nancy’s public key M
    8·1 answer
  • A series of projects that are organized in such a way that each project utilizes people from different functional areas is using
    12·1 answer
  • In what type of cluster does every server perform useful work so that if one fails, the remaining servers take on the additional
    7·1 answer
  • Consider a system consisting of m resources of the same type, being shared by n processes. Resources can be requested and releas
    9·1 answer
  • Which statement best describes an academic goal?
    14·2 answers
  • What devise did george stbitz contribute?
    13·1 answer
  • nder a Huffman encoding ofnsymbols with frequenciesf1, f2, . . . , fn, what is the longest a codewordcould possibly be
    13·1 answer
  • Can you distinguish between the following examples and determine which one is NOT creative work? a. software b. slogan c. screen
    15·1 answer
  • each data mining technique has its advantages and limitations. which data mining technique mimics the neural structure of the br
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!