Difference between revisions of "Program A Day: Getting Started"

From CompSciWiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{1010Prad|Introduction=  
+
{{1010PrAD|Problem=  
  
Some of you have seen your first program this week. Good idea to try writing some programs yourself. Programming certainly gets easier with practice.
 
 
|Image=
 
[[Image:OperatingSystemExample.jpg|float|267px]]
 
<BR>
 
Taken from http://www.flickr.com/photos/daniello/565304023/
 
 
}}
 
 
__NOTOC__
 
__NOEDITSECTION__
 
 
=Problems=
 
 
==Hello World!==
 
  
 
You're joining a tradition! Most computer scientists begin their programming career by writing a short program that outputs the message "Hello World". Of course, you could customize your message.  
 
You're joining a tradition! Most computer scientists begin their programming career by writing a short program that outputs the message "Hello World". Of course, you could customize your message.  
Line 28: Line 13:
 
7. Revise your output to read "Hello [name]" where name is the value stored in the String variable.  
 
7. Revise your output to read "Hello [name]" where name is the value stored in the String variable.  
  
==MadLib==
 
A Madlib is a fun little game where a player is prompted to enter (input) a series of nouns, verbs, numbers, etc. Then the words are inserted in a story or poem, often with kind of funny results.
 
For example, ask the user to enter...
 
  
To Do: Write a program that lets the user play a Madlib.
+
|SideSection=
 +
[[Image:OperatingSystemExample.jpg|float|267px]]
 +
<BR>
 +
Taken from http://www.flickr.com/photos/daniello/565304023/
 +
 
 +
}}
 +
__NOTOC__
 +
__NOEDITSECTION__
 +
 
 +
 
  
=Solutions=
 
  
==Hello World==
 
  
==MadLib==
 
  
 
<br/>
 
<br/>

Latest revision as of 11:17, 30 March 2010

Back to the Program-A-Day homepage

Problem

You're joining a tradition! Most computer scientists begin their programming career by writing a short program that outputs the message "Hello World". Of course, you could customize your message.

TO DO: 1. Write a message that outputs a greeting in System.out. 2. Test your code. 3. Now revise your code so the message is also output in a dialog box (use JOptionPane) 4. Test your code. 5. Now add a String variable. 6. Use JOptionPane to get the user to input a name. 7. Revise your output to read "Hello [name]" where name is the value stored in the String variable.

 

SideSectionTitle

float
Taken from http://www.flickr.com/photos/daniello/565304023/

Solution

Solution goes here.

Code

SolutionCode goes here. Please DO NOT put your code in <pre> tags!

Back to the Program-A-Day homepage







Chapter 1: Application Software Table of Contents Chapter 3: Hardware