c++ code a. 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 the ad. Store these values in parallel arrays. Then sort the arrays so that 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. // 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
c++ code a. 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 the ad. Store these values in parallel arrays. Then sort the arrays so that 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. // 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
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
c++ code
a. The Daily Trumpet newspaper accepts classified advertisements in 15 categories such as Apartments for Rent and Pets for Sale. Develop the logic for a
// 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
// 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
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY