[Solved] CSc20: Programming Concepts And Methodology II Lab 06

$25

File Name: CSc20:_Programming_Concepts_And_Methodology_II_Lab_06.zip
File Size: 499.26 KB

SKU: [Solved] CSc20: Programming Concepts And Methodology II Lab 06 Category: Tag:
5/5 - (1 vote)

Objective:

The objective of this lab is to get you some experience in processing strings character by character and in implementing stacks and queues in a class package.

The programming assignment:

In your lab05, replace instructors Tokenizer class and MyStackQueue package with your own.

Requirements:

  1. You must use a linked list to implement your queue.
  2. You must use an array to implement your stack.
  3. You must use the following frame work to implement your tokenizer.

class Tokenizer { private char [] Buf;

private int cur;

Tokenizer(String infixExpression) { Buf = infixExpression.toCharArray(); cur = 0;

}

boolean moreTokens() {

Skip blanks.

return cur<Buf.length;

}

Token nextToken() { 1. Skip blanks.

  1. if (cur>=Buf.length) return null;
  1. 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();

Use num to create and return an operand.

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

}

}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSc20: Programming Concepts And Methodology II Lab 06
$25