Explore BrainMass

Basic Programming: Designing Programs, Class Diagram, Pseudocode, and Designing Applications

Question 1
What is the screen output of the following code segment? Explain the reasoning behind your answer.
Test1 = 70
Test2 = 98
Test3 = 84
NumberOfTests = 3
Average = (Test1 + Test2 + Test3) / NumberOfTests
IF Average >= 90 THEN
Output = "Great job"
Output = "Your average is: ", Average
IF Average >= 80 or Average <=89 THEN
Output = "Nice work"
Output = "Your average is: ", Average
Output = "You will better next time!"

Question 2
What screen output does the following code segment produce?
p = 2
q = 4
while p < q
Output = "Adios"
r = 1
while r < q
output = "Adios"
r = r + 1
p = p + 1

Question 3
Design a program that allows a user to enter 10 numbers, then displays them in the reverse order of their entry. You
must use an Array as your data structure.

Question 4
Design a class named CustomerRecord that holds a customer number, name, and address. Include methods to set
the values for each data field and output the values for each data field. Create the class diagram and write the
pseudocode that defines the class.

Question 5
Design an application in which you declare an array of five numbers and store five values in the array. Write a try block in which you loop to display each successive element of the array, increasing a subscript by one on each pass through the loop. Assume you are working with a language that automatically creates an ArrayIndexOutOfBoundsException when a subscript is not correct for an array. Create a catch block that catches the exception if it is generated and displays the message, "Now you've gone too far."

© BrainMass Inc. brainmass.com July 18, 2018, 9:02 am ad1c9bdddf

Solution Summary

This posting contains the solution to the given problems.