Note there are many more marks going for the main problem than there are for Tie Break problems. You should only do the Tie Break problem if you feel that you can’t improve on the main problem.
With each problem there will be a number of examples. For the main problem, some of the examples will be used (in addition to other unseen tests) to test your program. In the Tie Break problems all the tests will be will be unseen. The example files and solutions will be on the hard disk. The names of these files will be as given in the problem.
When you are finished, ensure that you have saved your files onto the root directory of the D: drive. (That is, a BASIC program for problem A should be saved as D:\day2a.bas.) You will also be given a floppy disk at the end, and you must also save your files to this disk and give it to a supervisor.
Please note that you cannot write to the C: drive.
Best of luck
Since you are a classical music fan and have no way to judge the artistic merits of these songs, you decide on the following criteria for making the selection:
a) The songs will be recorded on the set of disks in the order of the dates that they were written.
b) The total number of songs included will be maximized.
10 5 3 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
3In this example there are ten songs, and three disks. Each disk can hold 5 minutes worth of songs. In this case, all the songs last five minutes, so obviously only three songs can be recorded.
5 6 4 4, 3, 4, 4, 5
4Here there are 5 songs and 4 disks that can hold 6 minutes each. However it is not possible to hold more than one song on any disk, so only four songs can be recorded.
10 5 3 3, 5, 1, 2, 3, 5, 4, 1, 1, 5
6In this example there are ten songs, and three disks. The second line contains the lengths of each of the songs. E.G. the first song that was recorded lasts three minutes. The maximum number of songs that can fit on one disk is 6. (Remember that they have to be in date order.)
It should read its input from a file called day2a.dat, and write its output to a file called day2a.sol. The two example input files and the solutions are on the D: drive. The names of the input files are test2a1 and test2a2. The solution files are called test2a1.sol and test2a2.sol.
Note that if your program generates correct results for these files, it does not mean that your program is correct.
N.B. If you are writing a BASIC program ensure that it terminates with a system command, so that it exits to DOS. This is essential if it is to be processed automatically. You will get zero marks for the program if you neglect to do this.
Given a group of friends, the money each person in the group spends on gifts, and a (sub)list of friends to whom each person gives gifts; you are to write a program that determines how much more (or less) each person in the group gives than they receive.
the number of people in the group,
a list of the names of each person in the group,
a line for each person in the group consisting of the name of the person,the amount of money spent on gifts, the number of people to whom gifts are given, and the names of those to whom gifts are given.
All names are lower-case letters, there are no more than 10 people in a group, and no name is more than 12 characters in length. Money is a non-negative integer less than 2000.
All gifts are integers. Each person gives the same integer amount of money to each friend to whom any money is given, and gives as much as possible. Any money not given is kept and is part of a person's ``net worth'' printed in the output.
5 dave laura owen vick amr dave 200 3 laura owen vick owen 500 1 dave amr 150 2 vick owen laura 0 2 amr vick vick 0 0
dave 302 laura 66 owen -359 vick 141 amr -150
3 liz steve dave liz 30 1 steve steve 55 2 liz dave dave 0 2 steve liz
liz -3 steve -24 dave 27
It should read its input from a file called day2b.dat, and write its output to a file called day2b.sol. The two example input files and the solutions are on the D: drive. The names of the input files are test2b1 and test2b2. The solution files are called test2b1.sol and test2b2.sol.
Note that if your program generates correct results for these files, it does not mean that your program is correct.
N.B. If you are writing a BASIC program ensure that it terminates with a system command, so that it exits to DOS. This is essential if it is to be processed automatically. You will get zero marks for the program if you neglect to do this.
The number of cats inside each (non-smallest) cat's hat is a constant, n. The height of these cats-in-a-hat is 1/(n+1) times the height of the cat whose hat they are in.
All heights are positive integers.
Given the height of the initial cat and the number of worker cats (of height one), find the number of cats that are not doing any work (cats of height greater than one) and also determine the sum of all the cats' heights (the height of a stack of all cats standing one on top of another).
216 125
31 671
5764801 1679616
335923 30275911
It should read its input from a file called day2c.dat, and write its output to a file called day2c.sol. The two example input files and the solutions are on the D: drive. The names of the input files are test2c1 and test2c2. The solution files are called test2c1.sol and test2c2.sol.
Note that if your program generates correct results for these files, it does not mean that your program is correct.
N.B. If you are writing a BASIC program ensure that it terminates with a system command, so that it exits to DOS. This is essential if it is to be processed automatically. You will get zero marks for the program if you neglect to do this.