Brian Pringle
asked on
Need sample basic program ideas to teach logic
I am teaching an introductory college course called "Computational Thinking" and am having a mental block coming up with sample programs for the students to create.
The course is designed to teach them how to "think like a computer" and involves them being able to create flowcharts, create pseudocode, and later in the semester they will create real programs using real syntax.
I am using RAPTOR to teach them flowcharts and logic. I have compiled a list of introductory programs that they need to create using RAPTOR and pseudocode. They are currently performing "If...Then" statements and "While" loops.
I have created examples, but they need more. I need more programs that they can create. So, I am looking to you to give me good ideas of basic logic programs that can be created using selections, loops, inputs, and outputs (just the basics for now). If you have any ideas, I would greatly appreciate it.
The course is designed to teach them how to "think like a computer" and involves them being able to create flowcharts, create pseudocode, and later in the semester they will create real programs using real syntax.
I am using RAPTOR to teach them flowcharts and logic. I have compiled a list of introductory programs that they need to create using RAPTOR and pseudocode. They are currently performing "If...Then" statements and "While" loops.
I have created examples, but they need more. I need more programs that they can create. So, I am looking to you to give me good ideas of basic logic programs that can be created using selections, loops, inputs, and outputs (just the basics for now). If you have any ideas, I would greatly appreciate it.
ASKER
I understand how to teach the course and the requirements, but just want some sample programs for them to code. I have come up with a long list starting with the basics, but want more for them to create.
For example:
1. Display a message that says “Hello World!”
2. Ask the user his or her name and then output “Hello, ” + name (note the space).
3. Ask the user for a number. Then ask the user for a second number. Add the two numbers together and display the result.
4. Ask the user if he or she would like to eat breakfast. If YES, then tell them to eat breakfast. Otherwise, tell them to go to school.
5. Ask the user if he or she watches TV. If YES, then ask what show he or she likes and display the output and end. If not, then display a message that they do not like to watch TV and end.
6. As the user for his or her age. If their age is less than 18, then display a message that they are too young to vote. Otherwise, display a message that they are old enough to vote.
7. Create a variable and assign it a value of “0”. While the count is less than 5, display the phrase “I love computers!” Increment the value by 1.
8. Ask the user for the price of an item. Ask the user for the local sales tax rate. Calculate the cost of the item plus the tax and display the final result.
Note: You will need to account for the sales tax rate being a percentage.
9. Write a program to calculate the sum of the first x numbers in a series, starting at 0. Ask the user how many numbers to include.
10. Ask the user for a number. Start a loop and keep dividing by two while the result is greater than 1. If the final result equals 1, then display that their number is a factor of 2. Otherwise, display that it is not a factor of 2.
For example:
1. Display a message that says “Hello World!”
2. Ask the user his or her name and then output “Hello, ” + name (note the space).
3. Ask the user for a number. Then ask the user for a second number. Add the two numbers together and display the result.
4. Ask the user if he or she would like to eat breakfast. If YES, then tell them to eat breakfast. Otherwise, tell them to go to school.
5. Ask the user if he or she watches TV. If YES, then ask what show he or she likes and display the output and end. If not, then display a message that they do not like to watch TV and end.
6. As the user for his or her age. If their age is less than 18, then display a message that they are too young to vote. Otherwise, display a message that they are old enough to vote.
7. Create a variable and assign it a value of “0”. While the count is less than 5, display the phrase “I love computers!” Increment the value by 1.
8. Ask the user for the price of an item. Ask the user for the local sales tax rate. Calculate the cost of the item plus the tax and display the final result.
Note: You will need to account for the sales tax rate being a percentage.
9. Write a program to calculate the sum of the first x numbers in a series, starting at 0. Ask the user how many numbers to include.
10. Ask the user for a number. Start a loop and keep dividing by two while the result is greater than 1. If the final result equals 1, then display that their number is a factor of 2. Otherwise, display that it is not a factor of 2.
@btpringle
What VB development and run-time environment are you using?
What VB development and run-time environment are you using?
Pick a language any language.. and us experts can provide the sample code. what do you want to use as your building block...
"C" is probably a good language as you can start with the basics and it is a low level language.. or even 'basic' which used to be the learning language of choice.
1.
"C" is probably a good language as you can start with the basics and it is a low level language.. or even 'basic' which used to be the learning language of choice.
1.
#include <stdio.h>
int main (void)
{
printf("Hello World\n");
return 0;
}
2.
#include <stdio.h>
/* this program can lead to a buffer overflow */
int main (void) {
char[256] name;
Printf("Please Enter Your Name");
name = gets();
Printf("Your Name is: %s\n",name);
return 0;
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I think everyone is missing the point. I know how to teach the class and am not looking for the code for a program. I am looking for concepts.
Specifically, I need more examples to HAVE THEM code/create/design pseudocode. I was just trying to get ideas for sample projects that they can create -- starting with very basic programs.
I am compiling a list of programs for them to make. Not the actual program, but just ideas for the projects.
Please read my first post. I am using RAPTOR, pseudocode, Small Basic, and Visual Basic 2010.
I am not asking for code -- just ideas for projects.
Specifically, I need more examples to HAVE THEM code/create/design pseudocode. I was just trying to get ideas for sample projects that they can create -- starting with very basic programs.
I am compiling a list of programs for them to make. Not the actual program, but just ideas for the projects.
Please read my first post. I am using RAPTOR, pseudocode, Small Basic, and Visual Basic 2010.
I am not asking for code -- just ideas for projects.
ASKER
For those of you not familiar with RAPTOR, here is the link to the Web page.
http://raptor.martincarlisle.com/
http://raptor.martincarlisle.com/
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
> I think everyone is missing the point.
It resembles the joke about the radio and the driver on the highway that goes in the opposite direction. :) The question is whether the goal does not miss the point.
Sorry, but think the chosen tools (the flowchart and the RAPTOR), the programming language (Basic), and the subject itself (algorithmic thinking), and the combination with beginners... It leads to nowhere, in my opinion.
My guess is that it will be rather tough, boring, and unpopular course where nor students nor you will find any kind of joy. The "(I) am having a mental block coming up with sample programs for the students to create" should not be ignored. It is a sign of something.
It resembles the joke about the radio and the driver on the highway that goes in the opposite direction. :) The question is whether the goal does not miss the point.
Sorry, but think the chosen tools (the flowchart and the RAPTOR), the programming language (Basic), and the subject itself (algorithmic thinking), and the combination with beginners... It leads to nowhere, in my opinion.
My guess is that it will be rather tough, boring, and unpopular course where nor students nor you will find any kind of joy. The "(I) am having a mental block coming up with sample programs for the students to create" should not be ignored. It is a sign of something.
> 1. Display a message that says “Hello World!”
print('Hello World')
> 2. Ask the user his or her name and then output “Hello, ” + name (note the space).
name = input('What is your name? ')
print('Hello, ' + name)
> 3. Ask the user for a number. Then ask the user for a second number. Add the two numbers together and display the result.
s = input('What is the first number? ')
n1 = int(s)
s = input('What is the second number? ')
n2 = int(s)
print('The sum of the two numbers is', n1 + n2)
> 4. Ask the user if he or she would like to eat breakfast. If YES, then tell them to eat breakfast. Otherwise, tell them to go to school.
answer = input('Would you like to eat breakfast? ')
if answer == 'YES':
print('Let's eat...')
else:
print('Go to school.')
etc. I can see nothing for flowcharts here. These runnable examples can be typed-in and tried almost as fast as you can explain them by plain words.
Perhaps it is time to get a book on learning computer programming fundamentals and then go through each chapter, teach your lesson and then assign a project that uses the principles of the chapter.
ASKER
@padas and @RobSampson
Thank you for providing usable information related to my actual question. I was just looking for a list of programs... not the code. Thanks for sticking to that and not going on a tangent.
Thank you for providing usable information related to my actual question. I was just looking for a list of programs... not the code. Thanks for sticking to that and not going on a tangent.
ASKER
@aikimark
Thanks for the Alice and Scratch programs. I am going to look into using Scratch next semester. I am still required to teach flowcharts and pseudocode (per the course competencies), but I think I can fit them in with that environment.
I am also using Small Basic, which is helping the students to feel comfortable converting their flowcharts and pseudocode into a real program.
I am also considering Python, but we may actually be in the process of developing an entire course for that language.
Thanks again!
Thanks for the Alice and Scratch programs. I am going to look into using Scratch next semester. I am still required to teach flowcharts and pseudocode (per the course competencies), but I think I can fit them in with that environment.
I am also using Small Basic, which is helping the students to feel comfortable converting their flowcharts and pseudocode into a real program.
I am also considering Python, but we may actually be in the process of developing an entire course for that language.
Thanks again!
Firstly, "computers are just bicycles for our mind" as someone nicely said. Then the "think like a computer" may not be acceptable. My experience is that we should rather understand what we want to solve. To understand means to "create a mental picture, mental model of the problem". That requires to think in abstractions -- drawing free-hand pictured, informal, can be more valuable to learn understanding. Flowcharts are too rigid these days, in my opinion. A decent pseudolanguage may be more readable and understandable.
Second phase is to learn the limited nature of computers -- they cannot deal with ambiguities that are naturally solved [based on contex] by humans.
My experience is that students do not want to show they do not understand the very basic terms, building blocks (say "byte" and what I can imagine it is, what it is capable of). They are not capable to pair it with their mental model -- but this is very essential. The first steps must be trained heavily to get the common ground for all. (Bottom-up approach -- as in programming; however, it must be mixed with top-down approach to avoid boredom.)
When solving problem, the way to show (themselves) they understand the problem is to solve it with paper and pencil -- no computer knowledge at the beginning. Moving from abstract view towards more formal, restricting way. Add the limits gradually -- e.g. "imagine, you can see one line on the paper from now on".
Write the natural description of the problem. Try to find regularities, try to shorten the description...