ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 22 May 2017 My Price 8.00

Famous programmer and open source activist

hi, i need a complete java code for this question.thanks for your help. :)

 

Famous programmer and open source activistRichard Stallmanhasoften complained thatcode on the web is unreadable, and that it isimpossible to determine its intentions by looking at it. In order to makejavascript code (which is always accessible to a website's user) fast andunreadable, developers use code obfuscators, which rename variablesand remove whitespace. Minified and obfuscated code is oftenespecially difficult to read because it appears in blocks. In order to helpcranky old developers likeMr. Stallmanreadcode, you will be writing aprogram that neatly formats javascript code.Fortunately, JavaScript looks a lot like Java: its instructions are delimitedby semicolons and its code blocks are delimited with curly braces. Yourjob will be to add new lines after each instruction, correctly indent thecode, and make sure that curly braces and parentheses are closed inthe correct order. By using a stack and a counter, you should also beable to determine the indentation level of the code, and determine if anyparentheses and curly braces are missing, or in the wrong order. If youcatch any code block or parentheses errors while neatly formatting yourcode, the program should stop and report the error to the user at the endof the now neatly formatted file.How it works: Read through the JavaScript file character by characterand copy it over to a new string. Every time you encounter a curly brace,or a semicolon (outside a for loop), add a newline character, as well asthe correct number of tab characters to the new string. The number oftabs starts at 0. Every time you encounter an opening curly brace, addone to the number of tabs. Every time you encounter a closing curlybrace, subtract one. Every time you encounter an opening curly brace,push the BRACE BlockType to the stack. Every time you encounter theopening parenthesis (that isn't part of the for loop), push the PARENBlockType to the stack. Every time you encounter the string "for(, pushthe FOR BlockType to the stack. Every time you encounter a closingcurly brace or closing parenthesis, pop from the stack. If the item youpopped does not match the type of closing character you encountered(or is empty), stop and print a new line explaining the problem. You donot need to continue to parse the rest of the file. Note: closingparenthesis matches both PAREN and FOR block types.

Attachments:

Answers

(11)
Status NEW Posted 22 May 2017 02:05 AM My Price 8.00

-----------

Attachments

file 1495421770-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)