Computer Science Canada

Turing Projects for Newbs!

Author:  Gadd [ Thu Apr 05, 2012 8:25 pm ]
Post subject:  Turing Projects for Newbs!

Hey guys, I wanted to help a few people out because I read a lot of messages and hear a lot of people say "I know how to code only if I knew what to code." So I am going to give you guess a bunch of questions... don't worry I will first tell you what it's about. example: loops... when I say that I mean, sure you can use if's and 500 lines of code but I want you to solve the problem WITH LOOPS!!! you can submit the code for checking if you want / questioning.

PART 1!!! before we start this isnt a tutorial on HOW TO USE (said wanted thing here) but ways you can practice and make examples / solving problems!

Documenting code wouldn't be that bad of an idea btw. When I say this Im telling you that you SHOULD.. just saying. Take note of things that didn't work, learn to solve .. and write it down. Smile It will help you be a better programmer

IF you do know programming and just wanna mess around and have something to practice with this helps too Smile


Chapter 1 - Introduction:
QUIZ
____
1. put "This is"
put "a program"

2. put "3*4 is equal to" ..
put 3*4

3. put "first line"..
put "second line"
put "third line"

4. put "3*7=",31
put "20/4+2=",20/4+2

5. What does the comma do on a "put" line?
6. What does the ".." do at the end of a put line?

DO:

1. Write a program that lists the addresses of 5 people. Include their name, street, city, postal code and phone number. Put each piece of information on a separate line, and have a blank line between each person's information.

For example:

Dan Scott
35 programmer st.
Location, ON
K8C Q1I
234-3421
?

2. Output can be formatted when it is output. Create a new program with the line

put "how many digits are seen here?",1/6
put "how many here?", 1/6:10:2

Run this simple program, and determine what the ":10" and the ":2" does to the program.

The ":10" at the end of the second line keeps the output to 10 spaces. Write a
program that makes 4 calculations that involve many decimal points. (e.g. 4/9).
Format the output so that the first calculation has 2 decimal points, the second calculation has 3 decimal points, and so on.

3. Write a program to calculate the Ontario tax on a pair of jeans that cost $49.99. Format the output and include an appropriate message.

4. Write a program to calculate the perimeter of a box with length 4.49m and width 10.29m. Calculate the area of the box too. Format both measurements to 2 decimal places.

5. When you use the formatting to "reserve space" for output, you can create a set of data that looks properly aligned. For example, you could get the data to look like:

Name Address Age School
John 12 Smith St. 18 NDCHS
Sarah 123 High St. 22 CPHS
Car 1 Lost Rd. 8 St. Mary's

Create a table that looks like this for 5 people.

(Remember this)
Turing:

put "":10, "Hello"


6. Write a program that creates a "bill of sale" for a company of your choice. The output for this program should "look like" a bill you would receive from any store: name of the store, address, time, etc. as well as the items purchased and their costs. For this assignment, your bill should include at least 3 items. There should be a total, as well as GST and PST calculations on the bottom of the bill. Whenever possible, you should use the techniques for formatting output outlined in this chapter. ex, put "":10, "HEY"

Here it is for Chapter 1. If you guys want some more chapters I will be glad to make them.. If Im allowed I can make all 11 chapters into one big thread.. if I get permission Smile Happy easter!!

Author:  Dreadnought [ Thu Apr 05, 2012 9:31 pm ]
Post subject:  Re: Turing Projects for Newbs!

Nice idea, this reminds me of the first days of programming class when we learned Turing.

Two comments:

Gadd wrote:
4. put "3*7=",31

I think that's a typo (shouldn't it be 21).


Gadd wrote:
5. When you use the formatting to "reserve space" for output, you can create a set of data that looks properly aligned. For example, you could get the data to look like:

Name Address Age School
John 12 Smith St. 18 NDCHS
Sarah 123 High St. 22 CPHS
Car 1 Lost Rd. 8 St. Mary's

I know there are tab characters but they don't show up (for me anyway), in this case it sorta defeats the purpose
Try using code tags. Note that I used spaces instead of tab characters (it lets you control the spacing a bit more).

code:
Name    Address        Age      School
John    12 Smith St.   18       NDCHS
Sarah   123 High St.   22       CPHS
Car     1 Lost Rd.      8       St. Mary's

Author:  Gadd [ Mon Apr 09, 2012 9:49 am ]
Post subject:  RE:Turing Projects for Newbs!

Well, that could be the documents fault, it's some of the stuff we were using to learn at school so ..


: