Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Start Redirect_Input(gradesix) j -1 Loop Yes End Of_Input No GET line IS NUMBER (line) marks[i] -- line IS STRING No (line) i-i+1 names -...

Given a text file that you create called "citytpr.txt", which contains temperature readings for various cities, develop a Raptor algorithm that sorts the temperatures in decreasing values. The sorted temperatures shall be written to a file called sortedcitytpr.txt (which is a file that raptor will create). The content of the files citytpr.txt and sortedcitytpr.txt must be stored in the formats shown below. For each city, the citytpr.txt includes the city name and the temperature respectively. The solution must work for any arbitrarily large file ( i.e. the number of city-temperature records must not be hard coded in the algorithm).

The submission must be an executable Raptor file of your flowchart solution.  

Content of citytpr.txt

Kingston

10

Milton

4

Calgary

2

Vancouver

14

London

11

Content of sortedcitytpr.txt

Vancouver: 14

London : 11

Kingston : 10

Milton : 4

Calgary : 2

Please note -

Since it is a sorting problem, the solution must resemble something like the main chart for the insert, selection or the bubble sorting algorithm - anyone of these will do. The only differences may be : (1) the sorting order (increasing or decreasing), (2) the swap. For the homework the swap must be applied to both temperatures and city names at the same time. For file reading check the example of Figure 7.9 (module 7).

Store the city names and corresponding temperatures in two separate arrays. Make sure that for any city, its name and temperature are placed at the same index position of their corresponding arrays. The problem at hand can then be solved by sorting the temperature array (using any one of the sorting algorithms) while at the same time moving the positions of the names in the city array so that they match the positions of their corresponding city temperatures being sorted.

StartRedirect_Input("gradesix")j -1LoopYesEnd Of_InputNoGET lineIS NUMBER(line)marks[i] -- lineIS STRINGNo(line)i-i+1names - lineJ-j+1Redirect_Input( False)End
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question