Lab 7 Solution

$30.00

Category: Tag:

Description

Section Readings: 3.1

Problem 1. (Array-based Symbol Table) Develop a symbol-table implementation ArrayST that uses an (unordered) array as the underlying data structure to implement the basic symbol-table API (p. 363).

  • java ArrayST Mercury 1 Venus 2 Earth 3

Mars 4 Jupiter 5 Saturn 6 Uranus 7 Neptune 8

Problem 2. (Frequency Counter) Modify FrequencyCounter from the text to use ArrayST from above and also to print all of the values having the highest frequency of occurrence, instead of just one.

$ java F r e q u e n c y C o u n t e r 1

to be or not to be that is the question

  • ctrl -d > to be 2 distinct = 8 words = 10

Problem 3. (Average GPA) Write an ArrayST client called AvgGPA that creates a symbol table mapping letter grades to numerical scores, as in the table below, then reads from standard input a list of letter grades and computes and prints the average GPA (the average of the numbers corresponding to the grades).

A+

A

A-

B+

B

B-

C+

C

C-

D

F

4.33

4.0

3.67

3.33

3.0

2.67

2.33

2.0

1.67

1.0

0.0

$

java

AvgGPA

B

A – A

A-BA-A-BA+BA+A-B-BB+B+ACA+F

  • ctrl -d >

3.2835

Files to Submit:

  1. ArrayST.java

  1. FrequencyCounter.java

  1. AvgGPA.java


error: Content is protected !!