Skip to content
soln standardAlgorithm
Share
Explore

sqa past papers

sample answers

2018 q12

question

The app will have information on the top 100 movies of all time including the studio that made the movie, fan ratings and takings at the box office.
For example
Title Studio Rating (out of 100) Takings ($m)
The Matrice Nightworks 85 6.7
The Home Route Gateway 42 0.4
Freezing Aurora 95 12.5
.... ..... ...... ......

record format

Using pseudocode or a programming language of your choice, define a suitable record data structure for the movie data above.

class movie {
String title = ""
String studio = ""
int rating = 0
double takings = 0.0
}

record variable (array)

Using pseudocode or a programming language of your choice, declare the variable which can store the details of the top 100 movies.
Your answer should use the record data structure created in part (i).
movie[] movieList = new movie[100]

algorithm (count)

Using pseudocode or a programming language of your choice, write an algorithm which:
• asks for a studio name
• totals the number of movies that the studio has in the top 100
• saves the studio name and total to file.

targetStudio = keyboard.nextLine
movieCount = 0

loop for index = 0 to movieList.length-1

if movieList[index].studio = targetStudio

add 1 to movieCount

end if
end loop

open file "studioTotal.txt"
write targetStudio, movieCount to file
close file


2017 q9

2017 q10

2016 q15


Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.