Q1: Pseudocode question
Given a scenario of a department store that wants to print out one month’s of net revenue by week.You are given a file of sales by week that you can assume can be read with a read module with variable of sales as the variable read in.
Each weeks sales are to be discounted by 20% (due to taxes) resulting in that weeks net revenue. If the net revenue is more than $3000 the print out should state that. The revenue is what is to be printed. The last step should print out the total new revenue for that month.
Write the PseudoCode
Note: your pseudo code should include the basic programming logic structures: Sequence Decision Looping
Hint: include the following as components of your pseudocode.
Initialization: accumulator(s)? counters? variables?
read module?
calculate ?
Print ? (A decision here)?
End?
Q2: Binary Search
Given a sorted array ( 1-based)
Array( 3 15 17 18 34 89 109 256 4096 50005001 6600 6634 7890)
and a target value of 15 show the sequence of steps in the following table:
Tell me how many steps to find the target value and fill in the table…
Step lowerbound upper bound midindex value at mid index
1 1 14 ?
Q3: Parsing Questions (@15)
Place parentheses correctly around these expressions
assume A B C are numeric while X Y Z are Boolean
1. A^2^3 / B / C
2. A > B and B > C * 10
3. A B C * A
4. X and Not B or Z
Q4: Function Fun
Given the function below: where Double means that parameters a b are floating point numerics.
def fun( a: Double b: Double ) = b * a > a
Write out the result and return the answer
1. fun(4 3)
2. fun(4 0.5 )
3. fun(2 + 1 2)