Design a program for the Hollywood Movie Rating Guide, in which users continuous
ID: 3760574 • Letter: D
Question
Design a program for the Hollywood Movie Rating Guide, in which users continuously enter a value from 0 to 4 that indicates the number of stars they are awarding to the guide’s featured movie of the week. The program executes continuously until a user enters a negative number to quit. I At the end of the program, display the average star rating for the movie.
This is what I have started so far,
MovieGuide.vb - This program allows each theater patron to enter a value from 0 to 4
' indicating the number of stars that the patron awards to the Guide's featured movie of the
' week. The program executes continuously until the theater manager enters a negative number to
' quit. At the end of the program, the average star rating for the movie is displayed.
Option Explicit On
Option Strict On
Module MovieGuide
Sub Main()
' Declarations
Dim numStars As Integer ' Star rating
Dim numStarsString As String ' String version of star rating
Dim averageStars As Double ' Average star rating
Dim totalStars As Double = 0 ' Total of star ratings
Dim numPatrons As Integer = 0 ' Keep track of number of patrons
' This is the work done in the housekeeping() procedure
' Get input
' This is the work done in the detailLoop() procedure
' Convert to Integer
' Write loop here
' This is the work done in the endOfJob procedure
' Calculate average star rating
System.Console.WriteLine("Average Star Value: " & averageStars)
End Sub ' End of Main() procedure
End Module ' End of MovieGuide module
Explanation / Answer
Module movie guide
// Declarations //
Dim NumStars As Integer // Star rating //
Dim NumStarsString As String //String version of star rating //
Dim AverageStars As Double // Average star rating //
Dim TotalStars As Double = 0 // Total of star ratings //
Dim NumPatrons As Integer = 0 // number of patrons //
This is the work done in the housekeeping() procedure
NumStarsString = InputBox ("Enter rating for featured movie: ")
' This is the work done in the detailLoop() procedure
NumStars = Convert.ToInt32 (NumStarsString)
' Convert to Integer
Catch ex As Exception MsgBox("You can only enter the numbers 0 through 4")
End Try
While NumStars >= 0 And NumStars <= 4
// Test for loop entry //
TotalStars += NumStars // total of star ratings //
NumPatrons = NumPatrons + 1 // Add 1 to number of patrons //
Try
NumStarsString = InputBox ("Enter rating for featured movie: ")
NumStars = Convert.ToInt32 (NumStarsString)
Catch ex As Exception
MsgBox("You can only enter the numbers 0 through 4")
End Try
End While
//This is the work done in the endOfJob procedure//
AverageStars = TotalStars / NumPatrons
Console.WriteLine("Average Star Value: " & AverageStars)
End Sub // End of Main() procedure //
End Module
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.