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

  Program should assign a seat in the first class

If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..

  Create a world class that contains a 2d array

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

  Create an application for disney''s cottages

Create an application for Disney's Cottages, a weekend getaway resort that rents cottages and boats to use on the local lake

  Create a driver class in java

Your project is to create a driver class that uses SuperJavaIceCreamClass.

  Method summarizesequences that takes a string as a parameter

Now implement the method summarizeSequences that takes a String as a parameter. This method should open the file named by this String, and read a sequence from that file into an array list using the getSequence method you wrote above

  What is the average response time for this system?

A web server receives a request every 50ms and processes web requests every 8 ms. Using queuing theory, 1. What is the average response time for this system?

  Create a java program to calculate the circumference

Create a Java program based on the geometric shapes. The program should begin by prompting you for the shape you want to calculate the circumference.

  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..

  Classes and pointers experience using dynamic memory

To practice defining classes using separate compilation using classes, vectors, and pointers experience using dynamic memory.

  Write a java program to implement the finite field

Write a program called "GF2.java" to implement the finite field GF(p n ) where p is a prime number and n is a positive integer.  You also need to write four methods to realize "+", "-", "´", and "/".

  Compute area and perimeter of a polygon

Create a project that would let a user compute area and perimeter of a polygon

  Creates an array named odds

Write code that creates an array named odds and stores all odd numbers between -6 and 38 into it using a loop. Make the array's size exactly large enough to store the numbers.

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