Access over 20 million homework & study documents

Java Questions

Content type
User Generated
Subject
Programming
Type
Homework
Rating
Showing Page:
1/8

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/8

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/8

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 8 pages?
Access Now
Unformatted Attachment Preview
Algorithm Workbench 1. Design a module named getNumber, which uses a reference parameter variable to accept an Integer argument. The module should prompt the user to enter a number and then store the input in the reference parameter variable. Module getNumber (Integer Ref number) Display “Enter a number “ Input number End Module 2. What will the following pseudocode program display? Module main () Declare Integer x = 1 Declare Real y = 3.4 Display x, “ “, y Call changeUs (x, y) Display x, “ “, y End Module Module ChangeUs (Integer a, Real b) Set a = 0 Set b = 0 Display a, “ “, b End Module The output of the program would be as follows 1, 3.4 0, 0 1, 3.4 Debugging Exercises 1. Find the error in the following pseudocode. Module main () Declare Real mileage Call getMileage () Display “You’ve driven a total of “, mileage, “ miles.” End Module Module getMileage () Display “Enter your vehicle’s mileage.” Input mileage End module The variable ‘mileage’ is declared in the main module as a local variable and then accessed from the ‘getMileage’ module. The variable is a local variable and can therefore not be accessed by statements that are outside the module. 2. Find the error in the following pseudocode. Module main () Call raiseToPower (2, 1.5) End Module Module raiseToPower(Real value, Integer power) Declare Real result Set result = value^power Display result End Module The arguments passed into the ‘raiseToPower’ module do not ha ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Anonymous
Just what I was looking for! Super helpful.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4