106k views
0 votes
Daily Life Magazine wants an analysis of the demographic characteristics of its readers. The marketing department has collected reader survey records containing the age, gender, marital status, and annual income of readers. Design an application that allows a user to enter reader data and, when data entry is complete, produces a count of readers by age groups as follows: younger than 20, 20-29, 30-39, 40-49, and 50 and older.

User Pacane
by
5.6k points

1 Answer

4 votes

Answer:

Step-by-step explanation:

Pseudo code for output age by group under 20,20-29 ,30-39,40-49 and 50 and older

start

Declarations

num numOfRecords=50

num count=0

num i

num ageCount[5]=0,0,0,0,0

string age[]=”0-20”,”20-29”,”30-39”,”40-49”,”>50”

num age[numOfRecords]

string gender[numOfRecords]

string maritalStaus[numOfRecords]

num annIncome[numOfRecords]

readRecords()

findAgeCount()

output()

stop

readRecords()

while count< numOfRecords

output “Enter Age”

input age[count]

output “Enter Gender”

input gender[count]

output “Enter Marital Status”

input maritalStatus[count]

output “Enter Annual Income”

input annIncome[count]

count=count+1

endWhile

return

findAgeCount()

while i< count

if age[i]>0 AND age[i] <=20

ageCount[i]= ageCount[i]+1

else if age[i]>20 AND age[i] <=29

ageCount[i]= ageCount[i]+1

else if age[i]>=30 AND age[i] <=39

ageCount[i]= ageCount[i]+1

else if age[i]>=40 AND age[i]<=49

ageCount[i]= ageCount[i]+1

else if age[i]>=50

ageCount[i]= ageCount[i]+1

i=i+1

endWhile

return

output()

output “Age”, “Count”

while i<5

output age[i],ageCount[i]

i=i+1

endWhile

return

B) Pseudocode for output count of readers by gender with in age group:-

start

Declarations

num numOfRecords=50

num count=0

num i=0

string age[]=”0-20”,”20-29”,”30-39”,”40-49”,”>50”

num age[numOfRecords]

string gender[numOfRecords]

num femaleCount[]=0,0,0,0,0

num maleCount[]=0,0,0,0,0

getfemaleCount()

getmaleCount()

Print()

stop

getfemaleCount()

while i<count

if gender[i]==”female”

if age[i] >0 AND age[i]<20

femaleCount[i]= femaleCount[i]+1

else

if age[i] >=20 AND age[i]<=29

femaleCount[i]= femaleCount[i]+1

else

if age[i] >=30 AND age[i]<=39

femaleCount[i]= femaleCount[i]+1

else

if age[i] >=40 AND age[i]<=49

femaleCount[i]= femaleCount[i]+1

if age[i] >50

femaleCount[i]= femaleCount[i]+1

endif

endif

endif

endif

endif

end if

i=i+1

endWhile

return

getmaleCount()

while i<count

if gender[i]==”male”

if age[i] >0 AND age[i]<20

maleCount[i]= maleCount[i]=+1

else

if age[i] >=20 AND age[i]<=29

maleCount[i]= maleCount[i]=+1

else

if age[i] >=30 AND age[i]<=39

maleCount[i]= maleCount[i]=+1

else

if age[i] >=40 AND age[i]<=49

maleCount[i]= maleCount[i]=+1

if age[i] >50

maleCount[i]= maleCount[i]=+1

endif

endif

endif

endif

endif

end if

endWhile

return

print()

output ”Age Range”,“Male Count ” ,”Female Count”

while i<5

output age[i],maleCount[i],femalCount[i]

i=i+1

endWhile

return

C) Pseudocode for output count of readers based income of readers under

Start

Declarations

num count=0

num i=0

num incomeGroupCount[]=0,0,0,0

string incomeRange[]=”0-$30000”,”$30000-$49,999”,”$50,000-69,999”,”>$70,000 “

num numOfRecords=50

num annIncome[numOfRecords]

findCountIncomeGroup()

printCount()

stop

findCountIncomeGroup()

while i<count

if annIncome[i]>0 AND annIncome[i]<30000

incomeGroupCount[i]=incomeGroupCount[i]+1

else

if annIncome[i]>=30000 AND annIncome[i]<49000

incomeGroupCount[i]=incomeGroupCount[i]+1

else

if annIncome[i]>50000 AND annIncome[i]<=69999

incomeGroupCount[i]=incomeGroupCount[i]+1

else

if annIncome[i]>70000

incomeGroupCount[i]=incomeGroupCount[i]+1

endif

endif

endif

endif

i=i+1

endWhile

return

printCount()

output “Income Range ”,”Readers count”

while i<5

output incomeRange[i], incomeGroupCount[i]

i=i+1

endWhile

return

Daily Life Magazine wants an analysis of the demographic characteristics of its readers-example-1
Daily Life Magazine wants an analysis of the demographic characteristics of its readers-example-2
Daily Life Magazine wants an analysis of the demographic characteristics of its readers-example-3
Daily Life Magazine wants an analysis of the demographic characteristics of its readers-example-4
User Dibi
by
5.4k points