Class Examples.

Slides:



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

Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
1 C++ string Class Chapter 6. 2 Agenda String Basics (cin, getline )  string operations mixed I/O using >> & getline() Table Output using setw() Functions.
What have we learned so far… Preprocessor directives Introduction to C++ Variable Declaration Display Messages on Screen Get Information from User Performed.
Hand Crafting your own program By Eric Davis for CS103.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Java Programming Practice.
1 Lab Session-3 CSIT221 Spring 2003 b Group Worksheet 3 Exercise (Demo Required) b No new lab demo will be assigned to allow you to focus on HW#1.
1 Lab Assignment#5 Due 12/7 A car can hold 12 gallons of gasoline and it can travel 360 miles without refuelling. Write a program the displays the trip.
Problem Solving #3: JVM ICS Outline Review of Key Topics Review of Key Topics Problem 1 Problem 1 Problem 2 Problem 2 Problem 3 Problem 3 Problem.
JavaScript with Input & Output Step 1: Use tags JavaScript Template.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Recursion Problem Solving and Program Design in C 5th Edition.
Programming.
THE BIG PICTURE. How does JavaScript interact with the browser?
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Introduction to Java Thanks to Dan Lunney (SHS). Java Basics File names The “main” method Output to screen Escape Sequence – Special Characters format()
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Chapter 1 Working with strings. Objectives Understand simple programs using character strings and the string library. Get acquainted with declarations,
© 2012 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 9: Recursion Problem Solving & Program Design in C Seventh.
Textbook Problem Java – An Introduction to Problem Solving & Programming, Walter Savitch, pp.219, Problem 08.
Homework #4: Operator Overloading and Strings By J. H. Wang May 8, 2012.
Moore machine and Mealy machine (P.274)
Practice with Lists and Strings CS303E: Elements of Computers and Programming.
Lesson 6. Python 3.3 Objectives. In this lesson students will learn how to output data to the screen and request input from the user. Students will also.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Susie’s lecture notes are in the presenter’s notes, below the slides Disclaimer: Susie may have made errors in transcription or understanding. If there.
How to Reset Your APICS Password Tutorial Also available at:
Validation final steps Stopping gaps being entered in an input.
Using variable Variables are used to store values.
Data Types and Conversions, Input from the Keyboard If you can't write it down in English, you can't code it. -- Peter Halpern If you lie to the computer,
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class.
 CSC111 Quick Revision. Problem Write a java code that read a string, then show a list of options to the user to select from them, where:  L to print.
Word Counter HW Copyright © 2012 Pearson Education, Inc.
Class Everything in Java is in a class. The class has a constructor that creates the object. If you do not supply a constructor Java will create a default.
Variables.. Part 2 Calculations. Review of yesterday Three types of variables var num:int var average:real var username:string No decimals Might have.
L AB 4 July 5th. F OR LOOP Exercise 1: Find two ways of “Summing all 1, 2, and 3 digit prime numbers.” Use for loop Hint: isprime, primes.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 3: Built-in functions.
Nested Loops CS303E: Elements of Computers and Programming.
Parallel embedded system design lab 이청용 Chapter 2 (2.6~2.7)
Print the sample banner slides or customize with your own message. Click on the letter and type your own text. Use one character per slide. C.
Object-Oriented Concepts
Exercise : Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased.
Input and Output Upsorn Praphamontripong CS 1110
Yanal Alahmad Java Workshop Yanal Alahmad
Maha AlSaif Maryam AlQattan
Lesson 3 - Repetition.
Psuedo Code.
Agenda Warmup Lesson 2.5 (Ascii, Method Overloading)
Computational Thinking
Computational Thinking
CSC 113 Tutorial QUIZ I.
Python I/O.
Use proper case (ie Caps for the beginnings of words)
Strings A collection of characters taken as a set:
ITunes Lab Copyright © 2012 Pearson Education, Inc.
Let’s get some practice!
Chapter 10: Recursion Problem Solving and Program Design in C 5th Edition by Jeri R. Hanly and Elliot B. Koffman.
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Jeff West - Quiz Section 4
STORE MANAGER RESPONSIBILITIES.
string functions isspace() – used to check the string is space x= “ "
The monitor shows information.
Python 10 Mr. Husch.
Hint idea 2 Split into shorter tasks like this.
CS 1111 Introduction to Programming Spring 2019
Chapter 11 Classes.
More on iterations using
The system unit processes information.
getline() function with companion ignore()
Computer Science Club 1st November 2019.
CS 11 – April 1 Review steps for lab #3
Presentation transcript:

Class Examples

Example 1 Write a program as the following : Class called initials containing: a private string to store the name Constructor to set the name to empty string Function to set the name Function to print the initials in capital letters. In the main ask the user to enter the name And print the initials Example 1

Output Example : Hint

Example 2 Write a program as the following : Class called following : Function follow take a sting and print the following letter for each character . In the main ask the user to enter the string Output example: Example 2