Task 1 1. Generate 100 random number between 1 and 6. 2. Print out in each line: a line number starting by line 1, follow by as many “*”s as 1’s were generated;

Slides:



Advertisements
Similar presentations
Chapter 3A Review boolean fun = true; if(fun) System.out.print(“yeah!”);
Advertisements

PR and The Visual Conference A Storyboard for Youtube.
Static Electricity Rare Occurrence or Common Hazard?
An Introduction to Hashing. By: Sara Kennedy Presented: November 1, 2002.
Control Structures. Decision Making Structures The if and if…else are all selection control structures that introduce decision-making ability into a program.
CS 206 Introduction to Computer Science II 03 / 04 / 2009 Instructor: Michael Eckmann.
Flowol The Task.
College of Business Emergency Procedures Summary Available at: cob-eps pdfhttp://uca.edu/mysafety/files/2013/06/bep-
Python Magic Select a Lesson: Why Learn to Code? Basic Python Syntax
Emergency Evacuations - Norristown October TMD-8303-SA Introduction / Key Topics To provide USM Employees & Management instructional guidance.
General Computer Science for Engineers CISC 106 Lecture 19 Dr. John Cavazos Computer and Information Sciences 04/06/2009.
Finch Robot Arrays Pepper. Light Sensor getLightSensors() It will return an array of 2 integers with: – Left sensor in 0 – Right sensor in 1 Possible.
This emergency evacuation briefing template is developed to encourage all hotels to adopt the good practice of conducting an emergency evacuation briefing.
SM1205 Interactivity Topic 06: Iteration and Multiple Objects Spring 2010SCM-CityU1.
An Introduction to Textual Programming
EMERGENCY EVACUATIONS - RED BANK May TMD-8303-SA-0013 R.1 2 Introduction / Key Topics To provide USM Employees & Management instructional guidance.
Arrays for Random Storage Another way to use an array is to create an array with dozens, hundreds or thousands of items and then randomly select from them.
Lec 19 Array Intro. Agenda Arrays—what are they Declaring Arrays Constructing Arrays Accessing Array cells.
Signature files. Signature Files Important alternative to inverted indexes. Given a document, the signature is calculated as follows. - First, each word.
Lecture 2: Static Methods, if statements, homework uploader.
JavaScript Lecture 6 Rachel A Ober
ADVANCED EV3 PROGRAMMING LESSON
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
Changing Color, Using Text Objects, and Random Selection in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2008.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
30/10/ Iteration Loops Do While (condition is true) … Loop.
Lec 20 More Arrays--Algorithms. Agenda Array algorithms (section 7.5 in the book) – An algorithm is a well-defined specification for solving a problem.
Coding Design Tools Rachel Gauci. Task: Counting On Create a program that will print out a sequence of numbers from "1" to a "number entered”. Decision’s.
04/11/ Arrays 1D Arrays Defining, Declaring & Processing.
Course A201: Introduction to Programming 09/16/2010.
Georgia Institute of Technology More on Creating Classes part 2 Barb Ericson Georgia Institute of Technology Oct 2005.
CPSC1301 Computer Science 1 Chapter 8 Introduction to Processing Digital Sounds part 3.
Two Forms Please use speaker notes for additional information!
Bubble Sort.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
CS1101X: Programming Methodology Recitation 6 Arrays I.
Week 6 : Sequences ( lists, strings, and tuples ).
Other Variable Types Dim lab as String makes a box that can store a label tag Dim ColHead As String ColHead = “function” ColHead function Dim lab as Boolean.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 10.
Lec 21 More Fun with Arrays: For Loops. Agenda Some backfill for Lab 20: – Using an array in an applet or class – array instance variables – using Math.random()
A loop is a repetition control structure. body - statements to be repeated control statement - decides whether another repetition needs to be made leading.
Photography Criticism search CNN to find this website:
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab 03.
School Safety Procedures
Variables  A piece of memory set aside to store data  When declared, the memory is given a name  by using the name, we can access the data that sits.
Conditionals Conditional statements, called conditionals for short, are statements in the if-then or if-then-else form. Examples: “If the alarm goes off,
Data Structures Arrays and Lists Part 2 More List Operations.
Intro-Sound-Mod10-part31 Introduction to Processing Digital Sounds part 3 while loop, tracing, for loop, parameters Barb Ericson Georgia Institute of Technology.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
CSC 4630 Perl 3 adapted from R. E. Beck. Problem But we worked on it first: Input: Read from a text file named in a command line argument Output: List.
Lockdown Procedure. The signal for a lockdown is a special bell followed by an announcement. Move to a safe area. Be silent Get out of sight Follow teacher’s.
Magic 8 ball. "Design and write a python program that emulates a Magic Eight Ball. Your program should continually prompt the user to enter a question.
Computer Science Up Down Controls, Decisions and Random Numbers.
CS1101X: Programming Methodology Recitation 6 Arrays I.
Computer Skills2 / Scientific Colleges 1 Arrays Topics to cover: Arrays Data Types One-dimensional Arrays Two-dimensional Arrays.
Week 9 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
ECS10 10/10
Diamond Hunt Mock Programming Project.
Reporting An In-Depth Guide.
Using the Percent Proportion
Using the percent proportion
2 Fire Fighter Safety.
Chapter - Karnaugh Maps
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
Hint idea 2 Split into shorter tasks like this.
Lec 21 More Fun with Arrays: For Loops
Presentation transcript:

Task 1 1. Generate 100 random number between 1 and Print out in each line: a line number starting by line 1, follow by as many “*”s as 1’s were generated; line 2 as many “*”s as 2’s were generated and so on, to line 6. Example: If 20 1’s were generated you should print: Line 1 ******************** 3. Do not forget to enter your name as a comment. 4. Screenshot of program and output.

Task 2 1.Write a program to store in a 2-D boolean array of size 5 and 10 a true value if a random value is less than 0.5 else false. Print only the indexes of cells with true value. 4. Screen shot of program and output.

Task 3 A large number of college students are attending a party. Each guest is drinking a can of beer or soda or lemonade or coconut. An emergency causes the lights to go out and the fire alarm to go off. The guests calmly put down their can and exit the building. When the alarm goes off, they re-enter and try to retrieve their can. However, the lights are still off, so each student randomly grabs a can. How many students if any got his or her original can? 1.Write a program to simulate this event, assuming there are N guests. Print out how many students got his or her original can. 2.Screenshot of program and output. Do not forget your name as a comment