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 haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

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

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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