Rewrite this code in order to ask the user for input

Assignment Help JAVA Programming
Reference no: EM13166550

This code is running fine .. i want to rewrite this code in order to ask the user for input and then coverth it from infex to postfix ,, so i want to put a Scanner and this ask the user for input .. how to do it ?

 

public static void main(String[] args)

throws IOException {

String input = "((3*4)+6)/2";

String output;

infix2postfix theTrans = new infix2postfix(input);

output = theTrans.doTrans();

System.out.println("Postfix is " + output + '\n');

}

This code is running fine .. i want to rewrite this code in order to ask the user for input and then coverth it from infex to postfix ,, so i want to put a Scanner and this ask the user for input .. how to do it ?

 

public static void main(String[] args)

throws IOException {

String input = "((3*4)+6)/2";

String output;

infix2postfix theTrans = new infix2postfix(input);

output = theTrans.doTrans();

System.out.println("Postfix is " + output + '\n');

}

Reference no: EM13166550

Questions Cloud

Keep track of the size of the array : Keep track of the size of the array so that you cannot exceed the array boundaries. The implementation details (i.e. the private members)of your class are up to you, but the class should have the following public interface
The user is assumed to enter the list in sorted order : Make sure you FULLY test your program! Make sure to run your program multiple times, inputting combinations of values that will test all possible conditions for your IF statements and loops. Also be sure to test border-line cases.
Interaction between the customer and the machine : In Python:Simulate a cash register or ATM including the interaction between the customer and the machine (i.e. assume that you are automating the responses)
Effective parenting tricks : If you are a parent, describe one of your favorite and most effective parenting “tricks” and how it achieves its goal. If you are not a parent, describe how you might have seen another parent handle a troublesome child.
Rewrite this code in order to ask the user for input : rewrite this code in order to ask the user for input and then coverth it from infex to postfix ,, so i want to put a Scanner and this ask the user for input .. how to do it ?
Important in the environment of our organizations : Wellness programs are so important in the environment of our organizations, however, the problem is that there is no real cost savings up front and the savings are usually soft dollars - in other words, dollars that are not being spent but that are a..
Nuclear weapons and nuclear energy : Based on current events, describe the state of nuclear energy and its peaceful uses in at least one country.  In your opinion, which is the greater threat – the use of nuclear weapons in war or the peaceful use of nuclear energy? Explain your answe..
Deceptive communicator : Your response was: One possible way to spot such deceptive communicator is to build the talk around them but not only about them. We can say out our message in between the lines when we are talking only about them and just making few references to wh..
Tradi-tional art critics : For what reason would Turner’s The Slave Ship have been criticized by tradi- tional art critics?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Consider a typical certification hierarchy

Why might Bob still not trust that the certificate for Alice truly establishes Alice as the owner of the public key in the certificate?

  Java program that will add the corresponding elements

Develop a Java program that will add the corresponding elements of two 1-dimensional arrays X and Y to produce the 1-dimensional array Z. Arrays X, Y, Z have the same dimension [M].

  Distance traveled modification

Distance Traveled Modification

  The ai player will not be asking

The AI player will not be asking the user for any input. This means that placeShips() and fire() should not ask the user for locations. The AI player should choose locations of ships and automatically place them

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Write a program that reads a file name from the keyboard

Write a program that reads a file name from the keyboard. The file contains integers, each on a separate line. The first line of the input file will contain the number of integers in the file. You then create a corresponding array and fill the array ..

  Build the gui layout of the game

Build the Build the GUI layout of the game in java.

  Write a method called negative sum

Write a method called negativeSum that accepts a Scanner reading input from a file containing a series of integers, and print a message to the console indicating whether the sum starting from the first number is ever negative

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  How to link different classes forms

How to link different classes forms. When a person clicks on A, B, or C the program will go to the addEmployee form or Punch In/Out form in Java.

  Write java program to read in sequence of hourly temperature

Write down Java program which reads in sequence of hourly temperature readings over 24-hour period using arrays. Your program must find and show maximum and minimum temperatures.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd