The last lesson of this term!

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

1 Various Methods of Populating Arrays Randomly generated integers.
Pamela Leutwyler. 9 goes into 36 four times with remainder = 9.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Topic 9 – Introduction To Arrays. CISC105 – Topic 9 Introduction to Data Structures Thus far, we have seen “simple” data types. These refers to a single.
ITERATIVE CONSTRUCTS: DOLIST Dolist is an iterative construct (a loop statement) consisting of a variable declaration and a body The body states what happens.
Kicking Long Division Problems Using an Area Model
Today our topic of discussion will be: Division by 2 digit divisors
CS 106 Introduction to Computer Science I 10 / 15 / 2007 Instructor: Michael Eckmann.
1 Assignment 8. Implementing type integer Due on Tuesday, 4 December, by midnight (submitted electronically). Download class List and a skeleton of class.
Introduction to Methods
The switch Statement, DecimalFormat, and Introduction to Looping
division algorithm Before we study divisibility, we must remember the division algorithm. r dividend = (divisor ⋅ quotient) + remainder.
CS1101: Programming Methodology Aaron Tan.
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Today we will be learning about Dividing with decimal remainders
W ORKING WITH D ECIMALS Summer Packet Review. Adding & Subtracting Decimals To add decimals, follow these steps: 1)Line up the decimals 2) Put in zeros.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 while loops. 2 Definite loops definite loop: A loop that executes a known number of times.  The for loops we have seen so far are definite loops. We.
Procedural Programming Criteria: P2 Task: 1.2 Thomas Jazwinski.
Intro to CS ACO 101 Lab Rat. Academic Integrity What does that mean in programming? Log into Blackboard and take the test titled “Applied Computing Course.
Introduction to OOP in VB.NET using Robots ACSE Conference, Nov 2004 Michael Devoy Monsignor Doyle C.S.S., Cambridge
Arithmetic Expressions Addition (+) Subtraction (-) Multiplication (*) Division (/) –Integer –Real Number Mod Operator (%) Same as regular Depends on the.
5 Minute Check Complete on the back of your homework x x x x 975.
Functions Structured Programming. Topics to be covered Introduction to Functions Defining a function Calling a function Arguments, local variables and.
Division Division Problems Do you have problems with division problems? Here is a guide to help you.
Module 4 Lesson 8. Objective:  Use math drawings to represent the composition and relate drawings to a written method.
Copyright © Cengage Learning. All rights reserved. 7 Rational Functions.
Data Structures & Algorithms CHAPTER 2 Arrays Ms. Manal Al-Asmari.
CS 106 Introduction to Computer Science I 02 / 15 / 2008 Instructor: Michael Eckmann.
Few More Math Operators
Introduction to Programming
Math operations 9/19/16.
CS 160 – Summer 16 Exam 1 Prep.
Repetition Structures
Multiplying Whole Numbers
Lesson #6 Modular Programming and Functions.
[ 4.00 ] [ Today’s Date ] [ Instructor Name ]
Lesson #6 Modular Programming and Functions.
Week 1 Real Numbers and Their Properties
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Reindeer don't go to public school, they’re elf taught.
Lesson 2: Program design process & Intro to code
Lesson #6 Modular Programming and Functions.
Arrays & Functions Lesson xx
While loops The while loop executes the statement over and over as long as the boolean expression is true. The expression is evaluated first, so the statement.
OPERATORS (1) CSC 111.
PC02 Term 2 Test Recursion and Sorting. PC02 Term 2 Test Recursion and Sorting.
Use proper case (ie Caps for the beginnings of words)
PC02 Consolidation Loading a witty quote…. PC02 Consolidation Loading a witty quote…
1. Open Visual Studio 2008.
<INSERT_WITTY_QUOTE_HERE>
Console.WriteLine(“Good luck!”);
CS150 Introduction to Computer Science 1
Our Environment We will exercise on Microsoft Visual C++ v.6
An Example of Interacting Classes
What's wrong with Easter jokes? They crack you up
Arrays.
Lesson #6 Modular Programming and Functions.
Fundamental Programming
Agenda Warmup Lesson 1.6 (Do-while loops, sentinels, etc)
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
Week 1 Real Numbers and Their Properties
Division of Polynomials
DIVISION 10 ÷ 2 = 5 Quotient LET’S LEARN
A counting problem Problem: Write a method mostFrequentDigit that returns the digit value that occurs most frequently in a number. Example: The number.
First Semester Review.
Presentation transcript:

The last lesson of this term! PC01 Term 2 Consolidation The last lesson of this term!

Today we are going to consolidate everything we’ve learnt so far Introduction Today we are going to consolidate everything we’ve learnt so far Feel free to pick any topic you want All work should be done in the same solution

Index Loops Static methods Classes Fixing Errors Click me Click me

The smallest perfect number is 6, which is equal to 3+2+1 Loops A perfect number is a positive integer that is equal to the sum of its proper divisors The smallest perfect number is 6, which is equal to 3+2+1 The next perfect number is 28: 28= 1+2+4+7+14 Let’s find first four perfect numbers!

Declare two variables: number and numbersFound Loops Declare two variables: number and numbersFound Create a while loop that keeps going while numbersFound is less than 4 Inside the loop, declare a variable and call it sum Then, make a for loop that goes from 1 up to number/2 (inclusive!) and uses i as a counter

This for loop should check the remainder of dividing number by i If the result is zero, then add i to the sum Once the for loop is finished, compare number and sum If they’re the same, increase numbersFound by one and print number to the console Regardless of the result, add one two number

Create a function that finds the sum of all digits of a number Static Methods Create a function that finds the sum of all digits of a number Call it “digitSum” It should accept one argument – a number And return a number as well

Declare a variable called answer Add a while loop Static Methods Declare a variable called answer Add a while loop It should carry on while the number is not zero Inside, find the last digit of the number using the modulus operator And add it do answer Then, divide number by 10

Go to main and test your function Static Methods Go to main and test your function Make sure the number it returns is correct

Create a class called Superhero Classes Create a class called Superhero Each superhero should have a name, a superpower, an attribute for checking whether or not they are a villain and an integer attribute for awesomeness Create a constructor which accepts four parameters It should print “A new superhero is created!” to the console Then, it should assign parameters to the Superhero’s attributes (nameParam to name, isVillanParam to isVillain, etc)

Go to main() and create two superheroes Classes Add a method called print() for printing all information about the superhero It should display all of their attributes Go to main() and create two superheroes Both should have random awesomeness One should be a villain Use whatever name and superpower you want

Call print() on both superheroes Then, compare their awesomeness Classes Call print() on both superheroes Then, compare their awesomeness Work out which superhero is more awesome and print a message like this to the console: “Ballistic Bat is more awesome than superBen”

Everyone’s favourite section – debugging! Fixing errors Everyone’s favourite section – debugging! Click here: … or type this link: goo.gl/QFGzVD You will need to unzip the folder (right click -> Extract all…) and double click on FixMe.sln Download the program

Enjoy your summer break! That’s it for this term! Enjoy your summer break!