1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Jlenok [28]
2 years ago
9

The Daily Trumpet newspaper accepts classified advertisements in 15 categories such as Apartments for Rent and Pets for Sale. De

velop 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

Computers and Technology
1 answer:
PtichkaEL [24]2 years ago
7 0

Answer:

see explaination

Explanation:

#include<iostream>

using namespace std;

#define MAXDAS 100

int main()

{

//int MAXADS = 100;

int adcatcode[MAXDAS];

int adwords[MAXDAS];

int curCode;

int numads;

int i,j,k;

int subtotal;

int temp;

cout<<"Please enter the number of ads: ";

cin>>numads;

if((numads > 0) and (numads <= MAXDAS))

{

for (i = 0;i<numads;i++)

{

cout<<"Please enter Advertisement Category Code (1 - 15): ";

cin>>adcatcode[i];

cout<<"Please enter number of words for the advertisement: ";

cin>>adwords[i];

}

for (i=0;i<numads-1;i++)

{

for (j = 0;j<numads-1;j++)

{

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;

}

}

}

cout<<"Total Word Counts Sorted By Category Code"<<endl;

cout<<"========================================="<<endl;

k = 0;

while(k<=numads-1)

{

subtotal = 0;

curCode = adcatcode[k];

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

{

subtotal = subtotal + adwords[k];

k = k + 1;

}

cout<<"Category: "<<adcatcode[k - 1]<<" "<<"Word Count: "<<subtotal<<endl;

}

}

else

{

cout<<"Number adds requested less than 1 or is too large; ad limit is :"<<MAXDAS;

}

return 0;

}

See attachment for output

You might be interested in
After stating your thesis, follow up by demonstrating the importance of the topic, and explain why the audience or future audien
bearhunter [10]

Answer: audience relevance

Explanation:

Most importantly when stating a thesis we should show and present how the work in the thesis is relevant to the audience. In this way we would be able to connect our research work more to the people and the audience. We should be able to state how our work is going to benefit them, what the people should do in this regard and all the dos and don't must be mentioned clearly while stating our thesis.

4 0
3 years ago
A posting error is:
Sunny_sXe [5.5K]

Answer:

The correct answer to the given question is option D) Any or all of the above.

Explanation:

A posting error is a type of error which is related to ledger and would include the errors like -

Posting wrong amount on the right side of account

Posting right amount on the wrong side of right account

Posting an amount twice and posting omission

Posting wrong amount to wrong side of right account

Posting correct amount on wrong account on right side

So by knowing all the given above points, it is quite clear that the correct option is D.

7 0
3 years ago
Select all the correct answers.
krok68 [10]

Answer:

Higher resolutions in games

Smoother, faster playback

Explanation:

A graphics card is a piece of hardware installed on a computer that that is responsible for rendering the image on the computer's monitor or display screen. Graphics cards come in many varieties with varying features. The CPU will send any graphics related tasks directly to the GPU while it continues to process other tasks. Because graphics cards use a lot of power they need a cooling fan. The cooling fans are noisy so they make the computer sound louder than they were before the graphics card was installed.

7 0
2 years ago
Read 2 more answers
Which of these is a physical health benefit provided by playing team sports? A. a spiritual connection to others B. lower choles
AfilCa [17]

Answer:

B. lowering cholesterol

Explanation:

Edge 2021, made a 100 on the quiz. Good luck :)

3 0
2 years ago
Read 2 more answers
What is the name of the mvost powerful battery
sergij07 [2.7K]
Optima battery because it is stronger than a factory battery
6 0
3 years ago
Other questions:
  • What kind of device is a printer? output or input
    13·1 answer
  • What is the term used to describe data sets are so large and complex that they become difficult to process using traditional dat
    12·1 answer
  • This is important I need help please
    14·1 answer
  • Is it better to meet online or offline<br> (Please answer QUICK)<br><br> Thanks :')
    5·2 answers
  • Displays are geared for a specific resolution. what is this resolution called?
    15·1 answer
  • WHICH COMPUTER COMPONENT CONTAINS ALL THE CIRCUITRY NECESSARY FOR THE OTHER COMPONENTS OR DEVICES TO COMMUNICATE WITH ONE ANOTHE
    12·1 answer
  • What are some difficulties in synchronizing audio and video during telecine transfer? (Select all that apply.)
    13·1 answer
  • Cuzzzzzzzzzzzzzzzz iiiiiiiiiiiiiiiii remember everytimeeeeeeeeee on these days that i feel like you and meeeeeeeeeeeeeee
    15·1 answer
  • Given the following array definition, write a constant declaration named ArraySize that automatically calculates the size in byt
    5·1 answer
  • GOOD EVENING, FRIENDS, I WANT TO ASK ON THE ACCOUNT OF HIS NAME‏BENJEMIN360 . THIS ANSWERS ARE VERY WONDERFUL, BUT I CAN'T COMMU
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!