Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify the mountain table program in Chapter 6 of Eloquent JavaScript http://elo

ID: 3845170 • Letter: M

Question

Modify the mountain table program in Chapter 6 of Eloquent JavaScript http://eloquentjavascript.net/ by:

Adding a BorderedCell constructor that makes cells with a border. That is, the top of the cell has dashes (use single dash, don't use underscore) across it, as well as the bottom. For the sides, use a "|". Test it by drawing a table with at least 2 rows and 2 columns with bordered text.

The result should output something like the following:

Use functional programming (higher order functions)

Mastro's Ocean II$$$$ I Club IS I I Denny's

Explanation / Answer

Modify the given table program that are attached with this and the output should look like the one png format are attached with this too.

1. Adding a new constructor named CenteredTextCell that creates a cell where all the lines in the cell are center-justified. That is, the draw method of this type of cell draws centered text (if there is an uneven number of padding spaces, put the extra one on either side). Test it by drawing a table with at least 2 rows and 2 columns with centered text.

2. Add a BorderedCell constructor that makes cells with a border. That is, the top of the cell has dashes (use single dash, don't use underscore) across it, as well as the bottom. For the sides, use a "|". Test it by drawing a table with at least 2 rows and 2 columns with bordered text.

3. Write a function that takes a row number and the main data array and transforms all the text for all the cells in that row to uppercase. You must use Array.prototype.map.

4. Write a function that takes a column number and the main data array and transforms all the text for all the cells in that column to uppercase. You must use Array.prototype.map.

5. Write a function that takes a Person, defined in Chapter 5 of Eloquent JavaScript (used for the author's ancestry; make sure you include all the properties and define them exactly like they are defined in Chapter 5), and converts it to a BorderedCell by taking all the information in the person and writing each one on a new line (along with the property name) to be displayed in the cell. Create a 3x3 matrix of 9 fictional (they can repeat). Using [url removed, login to view], write a function that takes a matrix of Persons and converts it to a matrix of BorderedCells. Use this function to transform your 3x3 array. Print out a table with this information using the table code.

6. Using the functions from #3 and #4, transform the first row of the above table to uppercase, and the last column, and redraw.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote