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

  Technical project: sample website project

Technical Project: Sample Website Project , This assignment consists of three (3) sections: a narrative, a storyboard, and a business Website. You must submit all three (3) sections for the completion of this assignment.

  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.

  Object-oriented analysis and design

Object-Oriented Analysis and Design,  PART B-object-oriented design involves the steps 13-18:

  Program to write variable declarations and function calls

Write a program whose main function is merely a collection of variable declarations and function calls. This program reads a text and outputs the letters, together with their counts.

  Creating personnel promotion application program

The following application program will be modified to accommodate the change to the database table. The personnel promotion application program.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Program to compute unit price of items sold

Manager of a Supermarket would like to be able to calculate the unit price of items sold there. To do this the program should input the name and the price of the item.

  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.

  Build a student record managing system application

Build a student record managing system application

  Creating loop to find number of items bought based on price

Make a block using a loop that will find the number of items that can be bought based on the price of the item and the total amount available to spend.

  Accuracy and completeness of computations

Analysis right and you have to develop a plausible argument to "prove" that your analysis is correct

  Unix systems administration

Unix Systems Administration

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