Given the following pseudocode, what is the value of myGrade after the call to the curveScore module? Module main() Declare Integer myGrade Set myGrade = 82 Call curveScore(myGrade) End Module Module curveScore(Integer score) Declare Integer newScore Set newScore = score + 5 Display newScore End Module Group of answer choices : A. 87 B. can not tell C. 82 D. 5
Given the following pseudocode: Class Coordinate Private Real _x Private Real y Public Module set_x(Real value) Set _X = value End Module Public Module set_y(Real value) Set y = value End Module Public Function get_x() Return _X End Module Public Function get_y() Return y End Module Public Module add(Coordinate c) Set _X = _X + C.get_x) Set y = y + c.get_y() End Module End Class Module main() Declare Coordinate ci - New Coordinate() Declare Coordinate c2 - New Coordinate()...
Write the pseudocode below as a working Python program. Take a screenshot of your code and output and paste into your answer document. User input of ‘y’ or ‘Y’ should cause the loop to continue. // Constant for the commission rate // Declare as a global variable Constant Real COMMISSION_RATE = 0.10 Module main() // Local variable Declare String keepGoing = "y" // Calculate as many commissions // as needed. While...
In the pseudocode below: Function Integer perfect(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + count End While Return sum End Function Function Integer perfect_sum(Integer n) Declare Integer count = 0 Declare Integer sum = 0 While count < n Set count = count + 1 Set sum = sum + perfect(count) End While Return sum End Function Module main() Display perfect_sum(5)...
I am supposed to a pseudocode function named max that accepts two integer values as arguments and returns the value that is greater of the two. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is greater of the two. Is everything correct and complete? //Pseudocode //This function takes two integers as parameters: x and y Begin : Max(x,y) If(x>y) then MAX=x Else MAX=y End if Return...
1. What are the problems with the following pseudocode? Be careful here, this one is tricky! Module main() Number siblingAge = 12 Display “your “+siblingType+ “ has” yearsUntilAdult(siblingAge) Display “years until they are an adult” End Module Module yearsUntilAdult(Number inAge) Character siblingType = “sister” If inAge < 18 Then Display inAge - 18 Else Display 0 End If End Module A. yearsUntilAdult module call can not see variable siblingAge so siblingAge can not be used as input into the module...
Please select the output: main declare X as integer, Y as integer set x=1 set y=2 call sub(x, y) write x write y End program Subprogram sub( integer Num1 as ref, Integer Mum2 as reference) declare x as integer set Num1 = 3 set Num2 = 4 set x= 5 write x end subprogram Please select one: 5/42, 5/34, 5/32, 5/24 What is the output of this...
Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the...
Look at this partial class definition, and then answer questions a - b below: Class Book Private String title Private String author Private String publisher Private Integer copiesSold End Class Write a constructor for this class. The constructor should accept an argument for each of the fields. Write accessor and mutator methods for each field. Look at the following pseudocode class definitions: Class Plant Public Module message() Display "I'm a plant." End Module...
Convert the following pseudocode into C++ language. Declare X, Y, Z As Integer For (X = 1; X < 4; X++) Write “Pass Number “ + X For (Y = 1; Y < 10; Y+3) Set Z = X + Y Write X + “ + “ + Y + “ = “+ Z End For(Y) End For(X)