[Solved] COMP9044 Test 4-Create Intergers File

$25

File Name: COMP9044_Test_4-Create_Intergers_File.zip
File Size: 348.54 KB

SKU: [Solved] COMP9044 Test 4-Create Intergers File Category: Tag:
5/5 - (1 vote)

Write a Shell program, create_integers_file.sh which takes 3 arguments.

The first & second arguments will specify a range of integers.

The third argument will specify a filename.

Your program should create a file of this name containing the specified integers.

For example:

Your answer must be Shell. You can not use other languages such as Perl, Python or C.

You are not permitted to use the Linux program seq.

No error checking is necessary.

When you think your program is working you can autotest to run some simple automated tests:

$ 2041 autotest shell_create_integers_file

When you are finished working on this exercise you must submit your work by running give:

$ give cs2041 test04_shell_create_integers_file create_integers_file.sh

Write a Perl program, create_integers_file.pl which takes 3 arguments.

The first & second arguments will specify a range of integers.

The third argument will specify a filename.

Your program should create a file of this name containing the specified integers.

For example:

$ ./create_integers_file.pl 40 42 fortytwo.txt

$ cat fortytwo.txt

40

41

42

$ ./create_integers_file.pl 1 5 a.txt

$ cat a.txt

1

2

3

4

5

$ ./create_integers_file.pl 1 1000 1000.txt

$ wc 1000.txt

1000 1000 3893 1000.txt

Your answer must be Perl only. You can not use other languages such as Shell, Python or C.

You may not run external programs, e.g. via system or backquotes.

No error checking is necessary.

When you think your program is working you can autotest to run some simple automated tests:

$ 2041 autotest perl_create_integers_file

When you are finished working on this exercise you must submit your work by running give:

$ give cs2041 test04_perl_create_integers_file create_integers_file.pl

It will be given two arguments n and the file name.

Your program should print nothing if the file does not have an n-th line You can assume n is a positive (non-zero) integer.

You should not assume anything about the lines in the file.

Your answer must be Perl only. You can not use other languages such as Shell, Python or C.

You may not run external programs, e.g. via system or backquotes.

No error checking is necessary.

When you think your program is working you can autotest to run some simple automated tests:

$ 2041 autotest nth_line

When you are finished working on this exercise you must submit your work by running give:

$ give cs2041 test04_nth_line nth_line.pl

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP9044 Test 4-Create Intergers File
$25