Program to use next character to create and return operator

Assignment Help Programming Languages
Reference no: EM1344454

Q1) How do you write a code for number 3 which is bottom of the code in a Tokenzier class.

if(Buf[cur]>=('0') && Buf[cur]<=('9')){
while(cur<Buf.length && Buf[cur]>=('0') && Buf[cur]<=('9')){ do something.
}
class Tokenizer {
private char [] Buf;
private int cur;
Tokenizer(String infixExpression) {
Buf = infixExpression.toCharArray();
cur = 0;
}
Token nextToken() {

1. Skip blanks.

2. if (cur>=Buf.length) return null;

3. If the next character is a digit, keep reading until a non-digit is read.
Convert the string of digits into an integer.
String Digits = new String(Buf, start, len);
int num = Integer.valueOf(Digits).intValue();
Create and return an operand.

4. Otherwise, use the next character to create and return an operator.
}
}

Reference no: EM1344454

Questions Cloud

Amount of funds-lockbox arrangement : J-Mart, the nationwide department store chain, processes all its credit sales payments at its suburban Detroit headquarters.
Illustrate a difference between the two models : Illustrate a difference between the two models and how does the concept of "no arbitrage" affect each model?
Define bootstrap financing : What is bootstrap financing it? Why don't all firms use bootstrap financing? Are there any dangers with this approach?
Public budgeting-type of marketable securities : Describe and discuss each and every type of Marketable Securities and Explain the major elements of the Theory of Budget Execution.
Program to use next character to create and return operator : Convert the string of digits into an integer. Otherwise, use the next character to create and return an operator.
Traks direct foreign investment : Show how would this affect Trak's direct foreign investment
Calculate the long position gain or loss : Greg recently inherited a large, family-run farm that primarily produces grain for harvest each year. Compute the long position gain or loss in this scenario.
Find what is duponts optimal capital budget : Find what is DuPont's optimal capital budget - The management of DuPont is planning next year's capital budget
Income statement including gross margin & sales general : The CEO of Smartphone Apps, LLC is making a loan application. Using the data below (only), make an Income Statement. Within this Income statement, include totals for Gross Margin,

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a vhdl code for soda vending machine

Write a VHDL code that implements the above soda machine. You have to turn in the following: A state diagram showing the implementation of your design. Clearly show all the states and the conditions on which transitions occur.

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Write the code required to analyse and display

Engineer for a materials manufacturing research lab and have been asked to provide an automated solution to analyse data.

  Formula translation

Write a c code that will evaluate the roots of a quadratic equation

  Application development and programming languages

Application Development and Programming Languages,  Programming languages have evolved since the First Generation Languages (1GLs) in the 1940s. The 1GLs were machine languages, which interacted directly with hardware. 2GLs were assembly languages. F..

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Produce a project plan

Produce a project plan and an interim description of the project development

  Write a paper on memory management

Write a paper on Memory Management

  Statement to read variables of type double

Suppose two variables p1 and p2 of type POINT, with two fields, x and y, both of type double, have been declared. Write a statement that reads values for p1 and p2 in that order.

  What is the throughput of the system

what is the throughput of the system

  Write a program that uses the curve class hierarchy

Write a program that uses the curve class hierarchy. The program should define several different objects, output their area, circumference, etc. It should also use the printcurve function.

  Discussion: html/css

Discussion: HTML/CSS,  "JavaScript Placement"  Please respond to the following: Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page. If so, explain wh..

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