Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// This program counts how many sales are made // in each of five categories of products start Declarations num category num SIZE = 5

// This program counts how many sales are made

// in each of five categories of products

start

Declarations

num category

num SIZE = 5

num QUIT = 9

num sales[SIZE] = 0, 0, 0, 0, 0

string HEAD1 = "Sales"

string HEAD2 = "CategoryNumber of Sales"

output "Enter category or ", QUIT, " to quit "

input category

while category = QUIT

if category > 1 AND category < SIZE then

sales[category - 1] = sales[category - 1] + 1

else

output "Invalid category"

endif

endwhile

output HEAD1

output HEAD2

while category < SIZE

output category + 1, sales[category]

category = category + 1

endwhile

stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions