ECOR 1606 CEDF – Week 4

Luke Boguski
[email protected]
4
Outside 402 MacOdrum Library
Tuesday 6pm – 7pm
ECOR-1606 CDEF
1)Introduction:

(10min)
Complete a title block for your code (see Appendix B)
2)The Problem:
(20min total)
You are writing the code for the website of a pizzeria. The purpose of your
program is to calculate the price of a pizza given how many toppings the customer
wants on the pizza.
- The base cost of a medium pizza is $5.00
- It costs $1.25 per topping
Ask the user how many toppings they want
Calculate the price of the pizza
Output the cost on the website
Bonus:
-
add a sentinel loop so the cost of many pizzas can be calculated
- indicate which pizza cost the most
3)The Flowchart:

Make a flowchart of the above problem
4)The Pseudocode:


(10min)
Using either C-- or pen and paper, write out your
solution in code to match your pseudocode and flowchart
6)Extra Challenges:

(5min)
Write the pseudocode that corresponds to your flowchart
5)C-- or Handwritten Code:

(10min)
(10min)
Add a while loop with a sentinel value around your
existing code ask the user if they wish to continue
calculating more roots
See if you can spot any bugs or logic that was left out
4
Luke Boguski
Outside 402 MacOdrum Library
[email protected]
Tuesday 6pm – 7pm
ECOR-1606 CDEF
7)Figure out the values of A and B:
double A = 0;
double B = 0;
double C = 0;
Line
Logic
(15min)
A
B
C
A = 14/2;
if(A != B){
B = A * 5;
C = A - 4;
}
A = B * C - 5;
A = _________
double
double
double
double
B = _________
C = _________
B = _________
C = _________
A = 1;
B = 2;
C = 3;
D;
A = A + C;
C = (A * B) - C;
B = C - A;
B = B * 3;
//swap
D = A;
A = B;
B = D;
A = _________
4
Luke Boguski
Outside 402 MacOdrum Library
[email protected]
Tuesday 6pm – 7pm
ECOR-1606 CDEF
double A = 4;
double B = 10;
while(B >= A){
B = 2 * B – 11;
if(fmod(B,2) == 1){
B = B - 3;
}
}
A = 2 * A – B;
A = _________
B = _________
double A = 7;
double B = -9;
double C = 3;
if(A > B){
B =-A;
C = A + B - C + 1;
}
while(B < 0 ){
A = A – 1;
B = B + 1;
}
A = _________
B = _________
C = _________
What do you call a singing computer?
Luke Boguski
[email protected]
4
Outside 402 MacOdrum Library
ECOR-1606 CDEF
10)Kahoot Quiz Closer:
-
Tuesday 6pm – 7pm
(10min)
https://kahoot.it/#/
Appendix A
Ground Rules:
Phones and laptops may only be used for Workshop purposes
Workshops are a safe, open, and fun learning environment
We are all here to learn/practice the content
Appendix B
- You may create the comment block on a notepad/text
file on your computer or personal device
- Introduce yourself to your table using your title
block (Say your program instead of student number)
***Please do NOT write your student number on a loose
sheet of paper, as it is sensitive material***