Computers and Technology

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

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 08:30, daskatingpanda
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
Answers: 1
image
Computers and Technology, 25.06.2019 00:30, alinton06
What is a typeface? a. a collection of similar text b. a collection of similar fonts c. a collection of similar designs d. a collection of similar colors e. a collection of similar images
Answers: 1
image
Computers and Technology, 25.06.2019 09:50, tatilynnsoto17
Part a: data processing given a data file, find the max, min, and average values of columns. also, create an addition column that is based on the other columns. there will be no error checking required for this lab. you are provided with a data file named (surprise! ) data. txt. data is arranged in columns where each item of data is twelve columns wide (so it is easy to extract data items using slicing): name height(m) weight(kg) joe 1.82 72.57 mary 1.60 63.50 dion 1.90 90.71 kayla 1.72 66.31 jose 1.78 70.23 sofia 1.63 65.12 erik 1.98 92.21 sara 1.57 65.77 your task is read the file data. txt and calculate the max, min, and average of the height and weight columns and to add an additional column that has the bmi calculated based on each height and weight. your output will look like this (and needs to be formatted like this). to match the testing on mimir here is the format string: "{: < 12s}{: < 12.2f}{: < 12.2f}{: < 12.2f}"
Answers: 3
image
Computers and Technology, 25.06.2019 10:30, shauntleaning
Why does the hp computer not have bluetooth?
Answers: 1
Do you know the correct answer?
The Daily Trumpet newspaper accepts classified advertisements in 15 categories such as Apartments fo...

Questions in other subjects:

Konu
Mathematics, 02.09.2020 14:01
Konu
Mathematics, 02.09.2020 14:01