11
Update(s) •2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be the same delivery mode: practice (EC) + exam. Library functions + loops + arrays (part1) Material is building on input, fprintf(), if and switch If you still have issues with the if, please come daily in my office to do/check your work. Print your code and bring it to the lecture, I’ll quickly go over it. Reminder: do not work together/collaborate on your work. Even as things get a bit harder. Review the cheating policy in the syllabus. STAY POSITIVE!

Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Embed Size (px)

Citation preview

Page 1: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Update(s)

• 2nd month of coding!• Exam1 – mostly good. Great improvements from the practice exam to the

exam itself!• Exam2 (week of March 4th) will be the same delivery mode: practice (EC) +

exam. Library functions + loops + arrays (part1)

• Material is building on – input, fprintf(), if and switch– If you still have issues with the if, please come daily in my office to do/check your

work. Print your code and bring it to the lecture, I’ll quickly go over it.

• Reminder: do not work together/collaborate on your work. Even as things get a bit harder. Review the cheating policy in the syllabus.

• STAY POSITIVE!

Page 2: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Lab08-tiles

1. Rounding2. Random

Page 3: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

New library functions seen

• These functions can be used together (as often is the case)K = rand*8+2 2<float<10K = ceil(rand*8+2) 3 4 5 6 7 8 9 10K = floor(rand*8+2) 2 3 4 5 6 7 8 9K = round(rand*6) 0 1 2 3 4 5 6

CAUTION: K = rand(2,5) does NOT generate a number between 2 & 5.

Rounding Generating random number

round() rand

ceil()

floor()

Page 4: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Today’s lab - background

• Retiling a floor!

What do you need?

Page 5: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

1st ingredient: the tiles

They come in many different sizes, for example:30 by 30 cm (13 by cartons)45 by 45 cm (8 by cartons)

Page 6: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

2nd ingredient: the mortar

- “The glue for underneath”- Spread using a notched-trowel

- There are again different size of trowel, for example:- 6mm- 12mm

- Depending on the size chosen, 1 bag won’t last as long.

Page 7: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

3rd ingredient: the grout

• The joints between each tile has to be filled with grout.

• Depending on the joint width, the number of bags needed is different!

Page 8: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Dimensioning the floor

• Snap a chalk line delimiting squares of 9 tiles

Advantages?- Cross check - Allows multiple people to

work in different rooms!

Grout joint

Page 9: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Your job today…

• Develop a program so the user can reuse it to calculate:– The number of tiles needed– The number of cartons needed– The number of bags of mortar needed– The number of bags of grout needed

None of these should be decimals!!

• To help the user decide… – Let the program offer the option of randomly choosing the tile size

and/or the trowel size.

Page 10: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Example output

Page 11: Update(s) 2 nd month of coding! Exam1 – mostly good. Great improvements from the practice exam to the exam itself! Exam2 (week of March 4 th ) will be

Important numbers