Easy Challenge 1
Write a program to write out the current date and time in this format (date format my vary if you are in US): 20:06:34 Saturday 31/12/2011
Write a program to place a randomly sized and positioned rectangle on the GraphicsWindow and then get the Turtle to draw round the rectangle’s perimeter.
- Write a program to read an entire text file into a SmallBasic variable.
You need to create a sample text file (sample.txt) somewhere first.
- Write a program to write out the data in a variable to a text file.
- Combine the 2 programs above into one program with 2 subroutines, one each to read and write to a file.
Add some user input to ask for the input and output file names (inside the subroutines) so that a file can be read in and then written out to a different file.
- Print out each character and its the Unicode value to the textwindow for each character in the text file.
Hint look at Text.GetLength, Text.GetSubText and Text.GetCharacterCode.
You need to check each character in a loop.
- Count the number of lines in the text file.
Hint: the unicode (ascii) codes for a ‘line feed’ is 10 and a ‘carriage return’ is 13.
These occur at the end of each line of text.
- Modify the program to remove the Unicode character output, but ask the user for some sub-text to change and replace to something else.
Get the program to find all occurrences of the sub-text and replace it with the replacement text and write the modified file out.
A company manufactures two types of tiles.
Type A is a trapezium with bottom 15 cm, top 5 cm and height of 10 cm
Type B is a parallelogram with base 14 cm and height 8 cm
Determine the total cost of labor which is calculated by the square centimeters of tiles produced.
In January there were 2,500 tiles of type A at a cost of 0.10 per square centimeter.
In February production of both tiles increases by 50% over January and maintained costs per unit.
Find the area of the trapezium and the parallelogram to calculate the area of each of the tiles.
Calculate the monthly cost of labor for the months of January and February for each type of tile.
Calculate the total monthly cost of labor for the months of January and February.
Advanced Challenge 1
Write a program to rotate a wireframe cube in 3D.
Advanced Challenge 2
Extend the Text and File Challenge to write a compression and decompression algorithm for this text file.
The compressed file must also store any information required for the decompression.