3 Pages

COS120 LECTURE 3

Course: COS 120, Spring 2008
School: University of Maine
Rating:
 
 
 
 
 

Word Count: 781

Document Preview

Chapter COS120 3.4 Strings Data Types: The programmer must specify the type of data that will be stored in a variable. Each data type is stored using a unique format and has available to it a certain set of operators and built-in functions. Data Type Integer Double Description Whole numbers Larger floating point numbers Range Approx. +/- 2 billion 14 digits of precision Some math functions include: CInt (string)...

Register Now

Unformatted Document Excerpt

Coursehero >> Maine >> University of Maine >> COS 120

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Chapter COS120 3.4 Strings Data Types: The programmer must specify the type of data that will be stored in a variable. Each data type is stored using a unique format and has available to it a certain set of operators and built-in functions. Data Type Integer Double Description Whole numbers Larger floating point numbers Range Approx. +/- 2 billion 14 digits of precision Some math functions include: CInt (string) CDbl (string) Int (double) Math.Sqrt (number) Math.Round (number,n) return the integer value equivalent to the string of digits return the double value equivalent to the string of digits return the whole integer after truncating the decimal portion Ex. Int (4.5) 4 return the square root of the number Ex. Math.Sqrt (9) 3 return the value of the number rounded to the specified number digits to the right of the decimal point. Ex. Math.Round (2.317, 1) 2.3 Note: Math is an object that has associated function (methods). Each of the functions is invoked by writing the name of the object, period ( . ), and the name of the function with its parentheses and arguments (ex. Math.Sqrt (9.4) ) Data Type String Description Group of characters A character is stored in one byte (8 bits) via its ASCII (ANSI code). For example the code for letter A is: 0100 0001 Most ASCII charts do not list the bit sequence but instead convert the code to an integer and report the integer value. Mathematically, the number 0100 0001 in base 2 is equivalent to 65 in base 10. 0100 0001 = 1 * 26 + 1 * 20 = 64 + 1 = 65 The Text property of a Text Box is data type String. Recall the CInt or CDbl functions were used to convert strings of digits into numbers for math processing. Dim x As Double x = CDbl (txtHeight.Text) It is considered proper programming technique to do this manual conversion upon data entry although the computer will do it for you. 1 The Items in a List Box are also String data type. Although there is a CStr function that converts a number to a string, it is often omitted upon display. Dim x As Double = 5.5 lstOut.Items.Add (CStr(x)) Dim x As Double = 5.5 lstOut.Items.Add (x) Some ASCII codes are listed below and the full chart is in the back of your text. A B a b 1 2 65 66 97 98 49 50 _ space 169 176 188 32 Chr (number) Asc (string) return the ASCII character with the number code Ex. "45" & Chr(176) & " Fahrenheit" 45 Fahrenheit return the ASCII code of the first character in the string Ex. Asc ("Apple") 65 String Properties and Methods: Each string also has a number of (data properties attributes) and methods available to it. These are useful when strings need to be manipulated by pulling them apart or searching for substrings. Dim s As String Dim t As String s = "Larry Smith" t = " Hello there " With lstOut.Items .Add (s.Length) .Add (t.Length) .Add (s.ToUpper) .Add (s.ToLower) .Add (t.Trim) End With 11 17 LARRY SMITH larry smith Hello there 2 ` two blanks are part of the string ` display the number of characters in s ` display the number of characters in t ` display s in upper case ` display s in lower case ` display t with leading and trailing blanks removed. Each character in a string has a position (0, 1, 2, etc.) A substring is a portion of a string that begins at a particular location. In string s above, substring "Larry" begins at position 0 and has 5 characters. Substring "Smith" begins at position 6 and has 5 characters. Dim s As String = "Larry Smith" With lstOut.Items .Add (s.IndexOf ("L")) .Add (s.IndexOf ("Smith")) .Add (s.IndexOf ("xxx")) .Add (s.SubString (0, 5)) .Add (s.SubString (6, 5)) .Add (s.SubString (2)) End With 0 6 -1 Larry Smith rry Smith ` returns the start position of "L" in s (0) ` displays start position of "Smith" in s (6) ` since "xxx" is not found in s, display -1 ` display substring of s with 5 characters ` starting at position 0 ("Larry") ` display substring of s with 5 characters ` starting at position 6 ("Smith") ` display substring of s starting at position ` 2 and continuing until the end ("rry Smith") 3 The program below illustrates common string processing. The user enters his or her full name in the form: first, blank, and last (Ex. "Joan Myers" or "Peter Mason"). The string is separated into the two pieces for processing. Private Sub btnCompute_Click( . . . Dim full As String Dim i As Integer full = txtFullName.Text i = full.IndexOf(" ") ' user full name (first last) ' position of blank ' get position of blank ' get first name from position 0 to index of blank position lblFirst.Text = full.Substring(0, i) ' get last name from position one more than blank to end of string lblLast.Text = full.Substring(i + 1) End Sub Full: i: 3 first: last: Full: i: 6 first: last: "Amy Folsom" full.Substring (0, 3) full.Substring (4) "Robert Cyr" full.Substring (0, 6) full.Substring (7) "Robert" "Cyr" "Amy" "Folsom" 4
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

University of Maine - COS - 120
COS120 Chapter 3.3 NumbersIn algebra a variable is an abstract identifier that stands for a number. In a programming language, a variable is associated with a memory address. When you store a value in the variable in your code, the computer writes t
University of Maine - COS - 120
COS120 Chapter 3.5 Input and OutputFormat Functions: When displaying a number to an output object, it is often formatted to look more attractive. Examples include restricting the number of digits, or adding a $ or % symbol. VB offers a number of for
Elon - JCM - 360
Media History Study Guide3/6/2008 11:16:00 AMThree Milestones to developing writing: Pictographic: A pictogram was a drawing of a natural object or event. Petroglyphs-carved on rock, petrogram- painted on rocks Ideographic: Provided a more sophis
Elon - ENG - 250
TABLE OF CONTENTS INTRODUCTION Why You Should Read this Book How to Use this BookSECTION I. LISTING AND BRIEF ACCOUNT OF PRINCIPAL CRITICAL APPROACHES TO LITERATURE A. Visual representation of key critical approaches an annotated poem B. Brief list
Elon - BIO - 101
BIOLOGY 101 -TOPICS IN GENERAL BIOLOGY SPRING 2008Review Sheet #1 Short Answers and 25 multiple choice. 10 true false. 10 fill in blank. And a bunch of matching.Look over this sheet and come to class on Wednesday having identified areas you wish to
Elon - JCM - 360
Lithography is a method for printing on a smooth surface. Invented by Bavarian author Alois Senefelder in 1796,[1][2] it can be used to print text or artwork onto paper or another suitable material. Benjamin Franklin (January 17, 1706 [O.S. January 6
Elon - JCM - 200
1 Mass Communications in the Global Age: Chapter Notes Chapter 1 The first communication revolution o 1450: Mainz, Germany; Johann Gutenberg created a system of printing from individual characters of type o Western Europe changed from an oral society
Centre College - FRS - 260
Order of Research 1) Details and general characteristics of movement a. Major artists of each movement i. Examples of women portrayed by these artists during these movements 1. Similarities and differences in portrayals a. Political/religious/social
Centre College - ANT - 307
ANT 307 Class Notes 1 April 2008 Marriage: Gender Roles, Patriarchy and Agency Feminism and race: White women less ideal as they resist gender role of subordinate to husbands Black women less ideal because of stereotypes, too sexual, asexual or not f
Centre College - ANT - 307
ANT 307 Class Notes March 6th 2008 Surveys Three varieties: 1. Face-to-face interviews a. Can be used with people who cannot read or see b. Offers an explanation of questions c. Use visual aids, graphs, cue cards d. Can take longer than telephone or
FSU - CLT - 3370
Friday November 30, 2007 Juno Lucina was aspect of goddess Juno associated with light and childbirth. Juno Regina emphasized Juno's role as wife of Jupiter and Queen of the gods. Juno Sospita, or Juno the preserver, was an ancient goddess of Etruscan
FSU - CLT - 3370
Monday November 5, 2007 Acrisius was the son of Abas and Aglaea. Had a twin brother, Proetus, and it was said they fought even in the womb. - When Abas died, Acrisius expelled Proetus but shared the kingdom by giving him Tiryns. An oracle prophesized
FSU - CLT - 3370
Monday November 19 2007 Jason was the son of Aeson. Alcmide sent her son Jason to a centaur, Chiron, for education purposes, fearing that Pelias would kill him. Pelias sent Jason to get the Golden Fleece, thinking it would be impossible. - Jason gath
FSU - CLT - 3370
Friday November 16 2007 The Erechtheum is an ancient temple was got its name from the shrine dedicated to the Greek hero Erichthonius. - The temple itself was dedicated to Athena and Poseidon Erechtheus. The sacred snake of the temple lived there, wh
FSU - CLT - 3370
Friday November 9, 2007 The Twelve Labors of Herakles are: - The first labor was to kill the Nemean Lion, a lion with an impenetrable hide. - The second labor was to kill the Lernaean Hydra, a serpent with nine heads and poisonous breath. - The third
FSU - CLT - 3370
Friday December 7, 2007 Seven Kings of Rome -Romulus 753-715 BC -Numa Pompilius 715-673 BC -Tullius Hostilius 673-642 BC -Ancus Martius 642-617 BC -Lucius Tarquinius Priscus 616-579 BC -Servius Tullius 578-535 BC -Lucius Tarquinius Superbus 534-509 B
FSU - CLT - 3370
Friday October 19th, 2007 Scamander was a river god, son of Oceanus and Tethys. Fought on the Trojans side. He tried to drown Achilles after being mocked by him, but Hera and Hephaestos stopped him. Achilles had an affair with Deidamea, having a chil
FSU - AMH - 2020
AMH 2020-05 Spring 2007 U.S. HISTORY/ 1865-Present 102 BEL, MTWRF: 2-315 INSTRUCTOR: Jon Mikolashek GRADER: Liz Bryant OFFICE: Bellemy 450 PHONE: E-MAIL: jbm04g@fsu.edu/liz4181@gmail.com OFFICE HOURS: MWF: 1-150 or by appointment Feel free to stop by
Centre College - ANT - 307
ANT 307 Class Notes 8 April 2008 *April 17th Each person should turn in an interview or oral history and each team should turn in a survey or focus group* *May 13th Final Ethnography Due*Birthing Fathers and Fixing Men Active participation of the
FSU - AMH - 2020
9004/at8FUlq t0tzto/{ee,us, eu/solcLull/ruoJErnleTpoatu.+,{!{t{\/:dllqura!l sar8r.lur,.dorn! r\iu, IlrlnJJ ]o slu.utrn.\oB .rl.l. I\luiP.rxrronsrsnl.r. ' L rl o d SIl e s o d d o l rl fi ' u ,tu u u uo' Jp!rJtrl rC ,.do.runpto.rfl qaN ql ,ss.uss.
Centre College - ANT - 307
ANT 307 Class Notes 10 April 2008 Due Dates: 4/11 Response Paper 4/17 Methodology Assignment 4/24 Take Home Exam The point of this take home exam is forcing a rereading of the ethnographies more closely and reading to answer certain questions. Some
FSU - CLT - 3370
Wednesday October 31, 2007 Aeschylus- the playwright who wrote the Agamemnon and 2 others plays. All three together are the Orestaia. Signal flames in Mycenae. A messenger sent from the Greeks tells them that Agamemnon has returned. Agamemnon returns
Centre College - ANT - 307
ANT 307 Class Notes 13 March 2008 Ethnography: due on May 13th by noon. Should provide a thoughtful description of a culture or aspect of social life. (a) Cover page (b) Discussion of research statement (c) Literature review (d) Explanation of resear
FSU - CLT - 3370
Wednesday October 17th, 2007 Achilles retreats from fighting in anger after Agamemnon takes Briseis. Myrmidons were soldiers commanded by Achilles. Chiron is superlative centaur that received Achilles as a disciple. Achilles married King Lycomedes' o
Centre College - ANT - 307
ANT 307 Class Notes 15 April 2008 The Ethnography: From Down Draft to Up Draft How to turn methodology into ethnography A Discussion of your Research Statement: What is the purpose of your research? What your research questions? What are your ontolog
Centre College - ANT - 307
Annie O'Brien ANT 307 Class Notes 3/25/08 Romance on a Global Stage -Gender stereotypes -Gender roles -Agency Essentialism Stereotypes of Race and Gender -The assumption that groups, categories or classes of people have one or several defining featu
Centre College - ANT - 307
ANT 307 Class Notes February 28th 2008 This week's response: anything we've read so far! On Tuesday: we will cover Nisa, Guests of the Sheik and Daughters of the DreamingFeminist Methodology presentations -Feminist Action Research: research should
FSU - CLT - 3370
Friday August 31, 2007 For more information, go to Oxford Classical Dictionary. Myths are elusive; they refer to other stories assuming you know the story. Bronze Age (3100-1020BC) - Birth of Greek culture, by Minoans and Myceneans. Taken from the 5
Centre College - ANT - 307
O'Brien Annie O'Brien ANT 307 Response #1 Dr. Andrea Abrams 14 March 2008 Women of Belize: A Feminist Form Earlier this semester, we discussed the basic principles of feminist research. These included, but were not limited to, creating a collaboratio
FSU - CLT - 3370
Friday September 7, 2007 Iconography of a god or goddess is a set of regular attributes and can be used to identify them. - Ex. Bow of Apollo, typical dress of a god, the sacred plant or bird associated with a god. Characteristics: - Zeus- sky god, b
Centre College - ANT - 307
Annie OBrien ANT 307 Response #2 28 March 2008 Romance on a Global Stage: Addressing Gender Roles and Issues Romance on a Global Stage, by Nicole Constable, is an ethnography that addresses the issue of foreign brides and ,mail-order marriages. In th
FSU - CLT - 3370
Friday September 14, 2007 Athena- has contest with Poseidon and wins by offering the olive tree. - Mycenean writing shows her as Potnia Atana. Potnia means "mistress". - She often goes to battle, is the warrior goddess. Athena Promachos is battle and
Centre College - ANT - 307
Annie O'Brien ANT 307 Response # 3 4 April 2008 Choice and Agency in Opting Out Pamela Stone' ethnography, Opting Out?: Why Women Really Quit Careers and Head Home, provides a thorough examination of the lives of women who choose to leave high-end po
FSU - CLT - 3370
Friday September 21, 2007 Big 3 tragic playwrights each contributing their own part: -1) Aeschylus - 2)Sophocles - 3) Euripides Tragedy means "goat song". The meaning of tragedy still resides with us today. Euripides- 480-406 BC. Only 18 of his plays
Centre College - ANT - 307
Annie OBrien ANT 307 Response #4 11 April 2008 Birthing Fathers: Feminist Anthropology in Questions of Masculinity Birthing Fathers by Richard Reed is an ethnography that describes the experience of becoming a father, focusing on the moment of birth
FSU - CLT - 3370
Friday September 28, 2007 Dionysos-Bacchus-Fufluns. Commonly known as the god of wine. - Linked to all liquid force. Elemental force of nature. Described as primal and irrational, life force and fertility. It could explain why he is associated with b
FSU - CLT - 3378
CLT 3378-05: ANCIENT MYTHOLOGY Williams 318, MWF 10:00-12:15pm Instructor: Ryan Magill Email: rmm06d@fsu.edu (please put CLT3378 in subject line) Course webpage: campus.fsu.edu Office: 205M, Dodd Hall Hours: MWF 1:00- 2:00pm and also by appointment
Centre College - ANT - 335
ANT 335 Notes *Do response paper (due Friday) Movie: Smoke Signals `How to be an Indian' Power and racial identity CDID (Certificate Degree of Indian Descent) Blood quantum (calculating the degree of Indian blood) Definition of Indianness, the effect
FSU - CHM - 1050
Purpose The purpose of this experiment is to get an understanding of measuring potentials of chemicals by creating small voltaic cells. Through this, we can find out how strong the electron flow is of two metals and how much electricity is produced b
Centre College - ANT - 335
Annie O'Brien ANT 335 Race and Ethnicity 9/18/07 Class Notes Johann Blumenbach On the Natural Variety of Mankind, 1795 -Emphasis on strictly physical criteria arranged in aesthetic terms -Caucasian as the primeval human variety; a variety that posses
FSU - MAC - 2313
Student Syllabus MAC 2313 - Calculus IIITime3:35 4:25 MW; 107 LOV; 3:35 4:50 TR; 107 LOV;Instructor InformationName: Steve Paris Email: paris@math.fsu.edu Office: 202 LOV Office Hours: 1:15 2:15 M, 2:30 3:30 T, 2:30 3:30 R, and by appointme
Centre College - ANT - 335
Annie O'Brien ANT 320 Class Notes 11/13/2007 Ethnic Group: A social group who share language, territory, sense of common ancestry or history, cultural behaviors, thought of themselves as a bounded and discrete group Afro-Centric consciousness Ideolo
FSU - MAC - 2312
STUDENT SYLLABUSMAC 231208,09,10Fall 2007Time: MWF 2:30 3:20pm, Room: LOV 101 INSTRUCTOR: Tianyu Zhang OFFICE: MCH 405A OFFICE HOURS: 10:00 - 11:30am T, R OFFICE PHONE: 850-645-7703 Email: zhang@math.fsu.edu(Please say "calculus 2" in the subj
Centre College - ANT - 335
Annie O'Brien GOV 110 Notes 11/16/2007 Assemblies (Legislature) -Law-making -Representation (constituency work) -Scrutiny and oversight -Education/Legitimacy -Recruitment and Training Executive and Legislative separation Presidential `pushing' of la
Centre College - ANT - 335
ANT 335 RACE AND ETHNICITY FINAL Key Points: - The differences and shifts in how racial identities are defined across time o Blacks, black Indians, Afromexicans: the dynamics of race, nation, and identity in a Mexican Moreno community: Laura A. Lewi
Centre College - ANT - 335
Annie O'Brien ANT 335 Response #4 2 November 2007 Identity and Its Definitions in San Nicolas "Who am I?" is not really a question because it has no answer to it; it is unanswerable . It is a device, not a question. Bhagwan Shree RajneeshThe defin
Centre College - ANT - 335
O'Brien Annie OBrien ANT 335 Response #5 16 November 2007 Principles In Action: The Manifestations of Afrocentrism in Daily Life The ideology of Afrocentrism has many different facets and definitions that contribute to its well-rounded and widesprea
FSU - CLT - 3370
Friday October 12th, 2007 Oedipus Rex written by Sophocles. - son of Queen Jocasta and King Laius. Laius learned by oracle that he would die by the hand of his son. Jocasta ordered that the baby be left to die. - a shepherd found him and raised him a
Centre College - BIO - 110
Spears Hinkle Biology 110 Study Guide: Test 1Chapter 1: - Atom molecule cell tissue organ organ system multi-celled organism population community ecosystem the biosphere Receptors molecules and structures that detect stimuli, whice are sp
FSU - CLT - 3370
Monday October 8th, 2007 Vladimir Propp's structural theory of hero: - Ten steps1) Hero has elements of extraordinary 2) Has oppositions from birth or young 3) Enemies instigate achievement 4) Has ally 5) Many obstacles, usually by quest or journey 6
FSU - CLT - 3370
Monday October 15th, 2007 Iliad and Odyssey were written by epic poet Homer about the Trojan War. Kypria- One of the Epic Cycle, the Trojan Cycle. Epic of ancient Greek literature. Ganymede- divine hero whose homeland was Troad. Trojan prince, son of
Centre College - BIO - 110
Spears Hinkle Biology 110 Quiz Answers: Chapters 1-7 Chapter 1: 1. The smallest unit of life is the cell. 2. Energy is required to maintain levels of biological organization, from cells to populations, communities, and even entire ecosystems. 3. Home
FSU - CLT - 3370
Monday October 22nd, 2007 Nostoi is a lost epic. Told the story of the Trojan war in epic verse. The Odyssey is based on the journey of the Trojan war through Odysseus, a greek hero. Menelaus' brother, Agamemnon, leader of the Greeks at Troy, is kill
Centre College - BIO - 110
Color blindness is a common, if relatively benign, genetic disorder. It occurs far more frequently in males than in females. Provide, based on your knowledge of the movement of chromosomes during meiosis, the mechanistic explanation for this observat
FSU - CLT - 3370
Monday October 29, 2007 Odysseus subdues Circe with help of Hermes to make him immune from magic of witch. - Sirens attempt to lure Odysseus with song about fame and glory. - Skylla has 6 dog heads. - Charybdis is a giant whirlpool. Odysseus' men are
Centre College - BIO - 110
Evolution post lab Are humans currently evolving? Answer this question by considering the conditions that are necessary for natural selection to operate in a population. Your answer should include discussion of several different human phenotypic trai