Download presentation
Presentation is loading. Please wait.
1
Computer Science 1 while
Mid Term Thursday/Friday Warm up How do you…
2
Goals Look at a CS Career example. Review the while loop
Complete the program from Thursday Push
3
Pathways This video shows five computer scientists in the field to get an idea of some of the possibilities for computer science careers. We will take a look at these as a class. Open the ‘pathways_in_computer_scienceworksheet’ from the class website. After viewing and discussing the careers you will need to answer the questions on the worksheet.
4
Review What are the semantics of a while loop?
When should you use a while loop?
5
While..loop semantics Get Variable While (variable<>flag) do
Begin 3. {Commands you will repeat} 4. Get Variable 5. End {Note: This will be on every test/quiz from now to the end of the semester!!}
6
While..loop Syntax While (condition) do Begin End;
More than one command; End; OneCommand;
7
While loop program options
Input: An unknown number of scores Output: The total and average score. Push: Calculate the highest and the lowest score Input: An unknown number of names and ages. Output: The name and age of the oldest person. Write a program t' hold an election for t' worst pirate (Unknown # o' voters…) Black Beard T' Great Pirate Roberts Henry Morgan t' Terrible Show t' results o' t' vote and declare t' worst pirate.
8
While loop program 2 Millionaire Slug in Well Menu for projects
Input: A starting amount of money and an interest rate. Output: A chart showing how much money the user has after each year and how many years it will take to become a millionaire. Push: Add a feature that incorporates an annual donation to savings Push: Modify it to compound monthly Slug in Well Input: The depth of a well. Process: The slug climbs up 3’ each day, but if it does not climb out of the well then it slides back down 2’ at night Output: A chart showing the height of the slug at the end of each day and the number of days it takes the slug to climb out of the well. Push: Show it graphically Menu for projects Create a menu using the while loop that will let the user run a program you have written previously and when finished it will ask if you would like to run it again or quit. Rock-paper-scissors,…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.