2 Pages

lab02

Course: CS 111, Fall 2009
School: Western Michigan
Rating:
 
 
 
 
 

Word Count: 436

Document Preview

2 - Laboratory Week of January 30-February 5 DUE: 11:55 p.m. on your lab day during week of February 13-19 Base Conversions Objectives: Write a complete program; Learn the use of looping structures and the switch statement. Learn about number bases. Background: We are used to base 10 numbers where each column is a power of 10 and has a range of 0 to 9. In computers we also commonly use other bases like base...

Register Now

Unformatted Document Excerpt

Coursehero >> Michigan >> Western Michigan >> CS 111

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.
2 - Laboratory Week of January 30-February 5 DUE: 11:55 p.m. on your lab day during week of February 13-19 Base Conversions Objectives: Write a complete program; Learn the use of looping structures and the switch statement. Learn about number bases. Background: We are used to base 10 numbers where each column is a power of 10 and has a range of 0 to 9. In computers we also commonly use other bases like base 2, 8 and 16. In general each column of a number is a power of the base with a range of 0 to the (base 1). So in base 8 the range of digits in a column is 0 to 7 and a 10 represents 8. Base 16 the range of digits in a column is 0 to F, 0, 1, 2, ... 9, A, B, C, D, E, F and a 10 base 16 is 16 base 10. Assignment: Write a program to convert a positive whole base 10 number from 0 to 255 to a base from 2 to 16. The program will ask for a number then the base to convert it to. Then it will output the original base 10 number in the new base. For example: the number 2 is entered to be converted to base 2, and the output says "2 base 10 is 10 base 2". Then the program asks if the user wants to covert another number. Rules: Your program must error check each of the two inputs looping until a legal number is entered. Your program use must a switch statement to decide what each digit of the new number is. For example in base 16: a 10 is A, an 11 is B and so forth. Your program must use a loop to do the conversion with decimal % base, then decimal / base. Submitting the Program Your laboratory instructor will set up the WebCt page for your laboratory section. Submit your final program via WebCt. NOTE: Submit only the C# source file. DO NOT submit any executable file (.exe). The algorithms: The main loop. Create an empty string S Get a number N between 0 and 255 inclusive. Get a base B between 2 and 16 inclusive. While the number is > 0 Get a digit using N % B Send the digit to a switch statement to convert it to a string, C Put the character C on the FRONT o...

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:

Western Michigan - SOC - 2600
References:Bennis v. Michigan, 516 U. S. 442 (1996), LexisNexis Scholastic Edition, Online (November 2006).
San Diego State - INCLASS - 240
Drake_BookCover.indd 1KimonoSteel4/7/08 3:05:30 AM
University of Iowa - MATH - 203
A handle body is a 3-manifold homeomorphic to a connected sum of solid tori. A Heegard splitting (of genus g) of a 3-manifold M consists of a surface F = #g T 2 which separates M into two handlebodies. 1 I.e. M = V1 f V2 where Vi are handlebodies of
San Diego State - DESIGN - 240
A 19 STORIES PRODUCTION bbieschke_dvdcover.indd 1.a LIFE style4/16/08 1:39:27 PM
San Diego State - DESIGN - 240
Partying. Rain. Wind. Cops. Tickets. Late Nights. All Day, All Night Driving. Bumbs In The Road. Road Rash. Smooth Pavement. 15 Stair Hand Rails. Glassy Faces. Off-Shore Winds. Epic Water Conditions.From going big, bombing hills and greasing handra
San Diego State - DESIGN - 240
University of Iowa - MATH - 132
\magnification 2400\parindent 0pt\parskip 10pt\pageno=13\hsize 7truein\hoffset -0.2truein\vsize 9.2truein\def\u{\vskip -10pt}\def\v{\vskip -6pt}Defn: $x \in X$ is a {\bf limit point} of $A$ iff $x \in U^{open}$ implies $U\cap A \ \{x\
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: HW1afall02.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f HW1afall02.dvi %DVIP
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: HW1bfall02.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f HW1bfall02.dvi %DVIP
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: HW2fall02.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f HW2fall02.dvi %DVIPSP
University of Iowa - MATH - 132
\magnification 1200\parindent 0pt\parskip 10pt\hsize 7.2truein\vsize 9.7 truein\hoffset -0.45truein\def\u{\vskip -7pt}\def\v{\vskip -6pt}HW 2 (p 83: 4, 8)4a.) Since $\emptyset, X \in {\cal T}_\alpha$ for all $\alpha$,$\emptyset, X \in \c
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: HWp111TOPO.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f HWp111TOPO.dvi %DVIP
University of Iowa - MATH - 132
\magnification 2400\parindent 0pt\parskip 12pt\hsize 7.2truein\vsize 9.7 truein\hoffset -0.45truein\def\u{\vskip -7pt}\def\v{\vskip -6pt}Defn: If $X$ is an ordered set and $a \in X$, then the following are rays in $X$: \centerline{$(a,
San Diego State - DESIGN - 240
Marisa Aguirre Art 240 M/W 12:00 Navas The Perks of Being a Wallflower- The cover is effective. The use of negative space along with the bright color makes it stand out from other books. The picture also sets the feeling of the book. There Is A (Slig
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: homework5.dvi %Pages: 2 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f homework5.dvi %DVIPSP
San Diego State - DESIGN - 240
Kirstin Powell, a young and struggling reporter thought she found the perfect husband when she met Peter Gomez. What Kirstin didn't know was that she married into a family with one of the largest drug trafficking operations. As she slowly learns the
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: hw43.dvi %Pages: 2 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f hw43.dvi %DVIPSParameters:
San Diego State - DESIGN - 240
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: hwP91.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommandLine: dvips -f hwP91.dvi %DVIPSParameter
University of Iowa - MATH - 132
Denition: A subbasis S for a topology on X is a collection of subsets of X whose union equals X. Lemma: If S is a subbasis for a topology on X, then B = {n Si | Si S} is a basis for a topology. i=1 Note that B is a collection of subsets of X (Si X
University of Iowa - MATH - 132
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: sub.dvi %Pages: 2 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %DocumentFonts: CMR10 CMBX10 CMSY10 CMMI10 CMMI7 CMR7 %EndComments %DVIPSWebPage: (www.radicaleye.com) %
University of Iowa - MATH - 133
\magnification 1400\parskip 10pt\parindent 0pt\hoffset -0.3truein\hsize 7truein\voffset -0.4truein\vsize 10truein\def\emph{}%\def\S{\Sigma_{i=1}^n}\def\Sm{\Sigma_{i=1}^m}\def\S{\sum_{i=1}^n}\def\s{\sigma}\def\ep{\epsilon}\def\f{\vski
San Diego State - INCLASS - 240
How life can change in a blink of an eye.A Biography BY Kristen LohmanA Biography BY Kristen LohmanJoanie Rae Smith has spent her high school years in a small town where she grew up. The teenage bully that she was, she still managed to be the
University of Iowa - MATH - 133
Randell's Submanifolds (2.3) = Boothby's Regular submanifold (III.5): If K is a submanifold of M , then K has the subspace topology. If ( , U ) is a chart for M such that (U ) = m (-, ) 1 m k and (U K) = 1 (-, ) k+1 {0} , then ( |U K , U K), |U
University of Iowa - MATH - 133
%!PS-Adobe-2.0 %Creator: dvips(k) 5.95a Copyright 2005 Radical Eye Software %Title: defnlie.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: CMR10 CMMI10 CMMI7 CMR7 CMSY10 CMMI5 CMSY7 CMTI10 %+ CMBX10 %DocumentPaperSizes: Le
University of Iowa - MATH - 133
\magnification 2000\parskip 10pt\parindent 0pt\hoffset -0.3truein\hsize 7truein\voffset -0.3truein\vsize 9.8truein\def\emph{}\def\S{\Sigma_{i=1}^n}\def\Sm{\Sigma_{i=1}^m}\def\s{\sigma}\def\ep{\epsilon}\def\f{\vskip 10pt}\def\h{\hski
University of Iowa - MATH - 133
%!PS-Adobe-2.0 %Creator: dvips(k) 5.95a Copyright 2005 Radical Eye Software %Title: tensorpart2.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: CMR10 CMMI10 CMBX10 CMSY7 CMSY10 CMTI10 CMR7 CMMI7 %+ CMEX10 CMR5 CMMI5 %Docume
University of Iowa - MATH - 133
\magnification 1400\parskip 10pt\parindent 0pt\hoffset -0.3truein\hsize 7truein\voffset -0.4truein\vsize 10truein\def\emph{}%\def\S{\Sigma_{i=1}^n}\def\Sm{\Sigma_{i=1}^m}\def\S{\sum_{i=1}^n}\def\s{\sigma}\def\ep{\epsilon}\def\f{\vski
University of Iowa - MATH - 133
B is bilinear if B(cv1 + dv2 , w) = cB(v1 , w) + dB(v2 , w) B(v, cw1 + dw2 ) = cB(v, w1 ) + dB(v, w2 ) Thus B(v1 , w1 ) + (v2 , w2 ) = B(v1 + v2 , w1 + w2 ) = B(v1 , w1 + w2 ) + B(v2 , w1 + w2 ) = B(v1 , w1 ) + B(v1 , w2 ) + B(v2 , w1 ) + B(v2 , w2 )
University of Iowa - MATH - 133
%!PS-Adobe-2.0 %Creator: dvips(k) 5.95a Copyright 2005 Radical Eye Software %Title: tensorpart2a.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: CMMI10 CMR10 CMR7 CMSY10 CMMI7 CMBX10 CMSY7 CMR5 CMMI5 %+ CMTI10 %DocumentPape
University of Iowa - MATH - 133
\magnification 1400\parskip 10pt\parindent 0pt\hoffset -0.3truein\hsize 7truein\voffset -0.4truein\vsize 10truein\def\emph{}%\def\S{\Sigma_{i=1}^n}\def\Sm{\Sigma_{i=1}^m}\def\S{\sum_{i=1}^n}\def\s{\sigma}\def\ep{\epsilon}\def\f{\vski
University of Iowa - MATH - 133
%\input eplain\magnification 1400\parskip 10pt\parindent 0pt\hoffset -0.3truein\hsize 7truein\voffset -0.3truein\vsize 9.8truein\def\emph{}\def\S{\Sigma_{i=1}^n}\def\Sm{\Sigma_{i=1}^m}\def\s{\sigma}\def\ep{\epsilon}\def\f{\vskip 10p
University of Iowa - MATH - 133
\magnification 1900\parskip 10pt\parindent 0pt\hoffset -0.3truein\hsize 7truein\voffset -0.4truein\vsize 10truein\def\emph{}\def\S{\Sigma_{i=1}^n}\def\Sm{\Sigma_{i=1}^m}\def\s{\sigma}\def\ep{\epsilon}\def\f{\vskip 10pt}\def\h{\hskip
San Diego State - INCLASS - 240
Beware the enemy still lurks.Hide your capitol gains, put away your white collars, the enemy still lurks. Careless talk will cost lives. They are watching you. Americas worst nightmare has come true, the worlds most feared communists have combined f
University of Iowa - MATH - 151
1.all * 2.1 2.2 * * 2.3 * * * 2.4 3.1 3.2 3.3 3.4 3.6 * 4.1 4.2 4.3Mathematical models Basic combinatorial counting Graphs and examples Connectedness Eulerian paths Trees Strong components Spanning trees Depth-first @ Breadth-first searches Weighte
University of Iowa - MATH - 151
22M:151 Discrete Mathematical Models, Spring 2004 Instructor: Office & Phone: e-mail: web-page Office hours: Textbook: Prerequisites: Oguz Durumeric Department of Mathematics, B20F MLH, 335-0774 odurumer@math.uiowa.edu OR oguz-durumeric@uiowa.edu htt
San Diego State - DESIGN - 240
VACATIONSara ZunigaBOOK COVER.indd 14/9/08 2:39:23 PM
San Diego State - DESIGN - 240
V C TO A A INSr Zn a aa u i g
San Diego State - DESIGN - 240
San Diego State - DESIGN - 240
University of Iowa - MATH - 150
\magnification 1200\parskip 9pt\parindent 0pt\hsize 7.4truein\hoffset -0.5truein\vsize 9.6trueinEx: Solve the recurrance relation: $h_n + h_{n-2} = 0$$h_0 = 3, h_1 = 5$$q^n + q^{n-2} = 0$$q^2 + 1 = 0$$q = \pm i$$h_n = c_1 i^n + c_2
University of Iowa - MATH - 150
7.4: Generating Functions g(x) = h0 + h1 x + h2 x2 + . is the generating function for the sequence h0 , h1 , h2 , . Ex: The generating fn for the sequence 2, 3, 4, 0, 0, 0, . is g(x) = 2 + 3x + 4x2 Ex: The generating function for the sequence 1, 1, 1
University of Iowa - MATH - 150
7.6: A geometry example Thm 7.6.1: Let hn = the number of ways of dividing a convex polygonal region with n + 1 sides into triangular regions by inserting diagonals which do not intersect in the interior of the polygonal region. Define h1 = 1. Then h
University of Iowa - MATH - 151
2.3: Communication NetworkQuestion: What (and who) are the minimum number of people you need to give a message in order for the message to reach everyone one else in the network.Answer: Find a vertex basis.Defn: A vertex basis of $G = (V, A)
University of Iowa - MATH - 151
\magnification 2200\parindent 0pt\parskip 5pt\nopagenumbers\hsize 7.5truein\vsize 9.9 truein\hoffset -0.45truein\def\u{\vskip -7pt}\def\v{\vskip -5pt}\input ./././PAPERS/GOLD/psfig2.4: Digraphs and matricesRecall if $A = (a_{ij}) $ and
San Diego State - DESIGN - 240
Untitled-3 14/9/08 2:15:52 PM
University of Iowa - MATH - 151
<?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>4ee54efa23a4a4d41bd912b7025f1647e12e7d69.txt</Key><RequestId>B2BC79CD71220871</RequestId><HostId>eJqdwIyKvSHa1JuzRAxsKH7nu7In
University of Iowa - MATH - 151
\magnification 2400\parindent 0pt\parskip 8pt\nopagenumbers\hsize 7.5truein\vsize 9.9 truein\hoffset -0.45truein\def\u{\vskip -7pt}\def\v{\vskip -5pt}\input ./././PAPERS/GOLD/psfigSuppose $D^*$ is the condensation of $D= (V, A)$. L
San Diego State - DESIGN - 240
San Diego State - DESIGN - 240
SARA ZUNIGAVACATIONVACATIONBOOKCOVER VERSION 2.indd 14/14/08 2:30:49 PM
Cal Poly - SESSION - 20020308
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:02:43.894 20020308-1-001_133740.jpg [001] Chapter 7- Local Area Networks (LAN): The Basics002: 00:02:43.894 00:00:03.277 20020308-1-002_133743.jpg [002] Acknowledgement00
Cal Poly - SESSION - 20020309
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:05:24.878 20020309-1-001_134126.jpg [028] Wireless Topology002: 00:05:24.878 00:00:54.167 20020309-1-002_134220.jpg [029] Wireless Topology003: 00:06:19.046 00:08:26.199
Cal Poly - SESSION - 20020208
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:00:46.433 20020208-2-001_144123.jpg [027] Mobile Telephone002: 00:00:46.433 00:03:21.152 20020208-2-002_144444.jpg [028] Mobile Telephone003: 00:04:07.585 00:00:09.339 20
Cal Poly - SESSION - 20020309
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:04:17.789 20020309-2-001_145730.jpg [039] Round Robin Protocols002: 00:04:17.789 00:04:06.175 20020309-2-002_150136.jpg [040] Round Robin Protocols003: 00:08:23.964 00:03
Cal Poly - SESSION - 20020125
<?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>3318be69bf697b7785f830d09d14ddc8aa14feda.txt</Key><RequestId>CD486CD5F798E35A</RequestId><HostId>txBY3THD8q7WvWEE1Em/Vz+UUUjY
Cal Poly - SESSION - 20020309
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:05:24.878 20020309-1-001_134126.jpg [028] Wireless Topology002: 00:05:24.878 00:00:54.167 20020309-1-002_134220.jpg [029] Wireless Topology003: 00:06:19.046 00:08:26.199
Cal Poly - SESSION - 20020208
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:13:54.871 20020208-1-001_140030.jpg [001] The Media: Conducted and Wireless002: 00:13:54.871 00:00:02.933 20020208-1-002_140033.jpg [002] Acknowledgement003: 00:13:57.804
Cal Poly - SESSION - 20020125
' Slide timing and title information ' Slide#: Start_Time Duration File_Name Title 01: 00:00:00.000 00:01:01.000 20020125-1-001_134639.jpg [001] Data Communications and Computer Networks02: 00:01:01.000 00:00:16.000 20020125-1-002_134740.jpg [002]
UNC - ECON - 001
UNIVERSITY OF NORTH CAROLINA ECONOMICS 101h: HONORS INTRODUCTORY ECONOMICS PRACTICE EXAMINATION # 1Prof. B. Turchi 9/28/2006GENERAL INSTRUCTIONS: There are eight (8) questions on this examination; please answer them all. Sign the honor code pledge
Cal Poly - SESSION - 20020322
'Sld#: Start_Time Duration File_Name [pg#] Title 001: 00:00:00.000 00:09:38.339 20020322-2-001_150740.jpg [020] Switches002: 00:09:38.339 00:00:37.105 20020322-2-002_150818.jpg [021] Switches003: 00:10:15.445 00:00:24.792 20020322-2-003_150
UNC - ECON - 001
Marginal Utility Theory of Household BehaviorWhen the theory of consumer behavior was first developed an approach different from the indifference curve analysis was utilized. Economists measured the satisfaction that a person received from a unit of