subject

The Daily Trumpet newspaper accepts classified advertisements in 15 categories such as Apartments for Rent and Pets for Sale. Develop the logic for a program that accepts classified advertising data, including a category code (an integer 1 through 15) and the number of words in an ad. Store these values in parallel arrays. Then sort the arrays so that the records are sorted in ascending order by category. The output lists each category number, the number of ads in the category, and the total number of words in the ads in the category. Using the following pseudocode. Thank you.

// Pseudocode PLD Chapter 8 #7a pg. 366

// Start

// Declarations

// num MAXADS = 100

// num adcatcode[MAXADS]

// num adwords[MAXADS]

// num curCode

// num numads

// num i

// num j

// num k

// num subtotal

// num temp

// output "Please enter the number of ads: "

// input numads

// if ((numads > 0) and (numads <= MAXADS))

// for i = 0 to numads - 1

// output "Please enter Advertisement Category Code (1 - 15): "

// input adcatcode[i]

// output "Please enter number of words for the advertisement: "

// input adwords[i]

// endfor

// for i = 0 to numads - 2

// for j = 0 to numads - 2

// if (adcatcode[j] > adcatcode[j+1])

// temp = adcatcode[j]

// adcatcode[j] = adcatcode[j+1]

// adcatcode[j+1] = temp

// temp = adwords[j]

// adwords[j] = adwords[j+1]

// adwords[j+1] = temp

// endif

// endfor

// endfor

// output "Total Word Counts Sorted By Category Code"

// output ""

// k = 0

// while k <= numads - 1

// subtotal = 0

// curCode = adcatcode[k]

// while ( (curCode == adcatcode[k]) and (k <= numads - 1) )

// subtotal = subtotal + adwords[k]

// k = k + 1

// endwhile

// output "Category: ",adcatcode[k - 1], " ","Word Count: ", subtotal

// endwhile

// else

// output "Number adds requested less than 1 or is too large; ad limit is ", MAXADS

// endif

// Stop

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
Answers: 1
question
Computers and Technology, 23.06.2019 20:40
Instruction active describing list features which statements accurately describe the features of word that are used to create lists? check all that apply. the tab key can be used to create a sublist. the enter key can be used to add an item to a list. the numbering feature allows for the use of letters in a list. the numbering feature can change the numbers to bullets in a list. the multilevel list feature provides options for different levels in a list.
Answers: 2
question
Computers and Technology, 23.06.2019 22:50
What is an rss reader used for? for creating a user account on a social new site
Answers: 2
You know the right answer?
The Daily Trumpet newspaper accepts classified advertisements in 15 categories such as Apartments fo...
Questions
question
Mathematics, 28.05.2021 18:30
question
Mathematics, 28.05.2021 18:30
question
Chemistry, 28.05.2021 18:30
question
Geography, 28.05.2021 18:30
question
English, 28.05.2021 18:30
question
Arts, 28.05.2021 18:30
Questions on the website: 13722361