There is an array that has all of the program names and there is an array that h
ID: 3917932 • Letter: T
Question
There is an array that has all of the program names and there is an array that has the number of faculties in each program. Both of these arrays are sorted alphabetically so that each element in the state table relates to the same element in the electoral vote table (Hint- Parallel Arrays):
Disciplines
Example
Number of Faculties
Art
4
Biology
10
Chemistry
7
…
…
Psychology
8
Design a program using pseudcode and modules that:
Displays the list of all of the discisplines with the number of faculties.
Displays the total numbers of faculties for all disciplines.
Displays the disciplines with the most faculties.
Displays the discipline with fewer than 5 faculties.
Disciplines
Example
Number of Faculties
Art
4
Biology
10
Chemistry
7
…
…
Psychology
8
Explanation / Answer
//Displays the list of all of the discisplines with the number of faculties.
Psedo code:
Start:
print From Starting index of the array containing the disciplines.
print the same index value from No. of faculty Array.
print the new Line.
jump to Start and repeat this until the last index.
//Displays the total numbers of faculties for all disciplines.
This is basically add all the elements of the faculty array.
example-faculty[]={4,10,7,5,9,5} Total=4+10+7+5+9=35
PSEDOCODE:
Start Index = 0 and Total=0
While index Not equal to Array length
Get the Value at Current Index;
total=total+Value
jump to next index
Repeat while Untill condition Fails
END
after loop Complete print Total
//Displays the disciplines with the most faculties.
PSEDO CODE:
we have 2 arrays 1.Discipnine 2. Facualty
Initially Max Set to 0.
Get the 1st element of Faculty array and set it as Max.
Jump to Next Index
while index not equal to last index Repeat Followings
check if value at current index is bigger then Max?
if true the Update Max with current Index
else
Jump to next Index.
END
Get The Final MaxValue;
Find The Value Of index=maxvalue from Disciplines array.
//Displays the discipline with fewer than 5 faculties
PSEDO CODE:
while index not equal to last index Repeat Followings
check if value at current index is less then 5?
if true Display the value of this Index from Discipnine array
else
Continue Checking by jumping to next Index
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.