CSCI 160 Assignment 5, Fall 1996 ADDED Nov 5: You are not allowed to use any of the predefined log functions (eg log, ln). Neither are you allowed to use any build in power function. In the latter case, you should write your own. DUE: The assignment is due on or before 3am, Thursday November 14. This assignment is worth 20 objective points. Your solution will be graded on the basis of its run-time behaviour and on the clarity and simplicity of the source code. See the marking guide in ~csci160/Pex5/markingGuide. With regard to simplicity and clarity, follow the ASAP principle: as simple as possible. INSTRUCTIONS: Issue the command: cp -r ~csci160/Pex5 . to copy the assignment work directory to your account. Locate to Pex5 and use the CSCI 160 Exercise Development Utility to test, verify and submit you assignment (enter the command make help for instructions on how to use the utility). Note, the file prototype is an executable. Your program should produce identical behaviour. This assignment is to completed by each student. Submit only one implementation; if you send more than one, we will discard all but the last one. The assignment identifier is CSCI 160 Pex 5 (see Course Information Sheet). Your assignment must be received before the due date and time. In addition, your e-mail must have the assignment identifier as its subject. All other methods of submission will not be accepted. You will receive no credit for an assignment submission that fails to adhere to this convention. QUESTION: Description =========== Your task is to write a Pascal program to convert user-specified numbers from one base to another. The program is to be menu driven. There are three items in the menu: <1> Convert from base 10 to a user-specified base <2> Convert from a user-specified base to base 10 <3> Quit When either of options 1 or two are selected, the user is prompted for a number and a number base. Your program should perform the conversion and write the answer. Your program should terminate when option 3 is selected. Sample Output ============= Base Conversion Utility --- Menu <1> Convert from base 10 to a user-specified base <2> Convert from a user-specified base to base 10 <3> Quit Enter your choice and press 4 INVALID INPUT Please enter another choice and press 1 Enter the number in base 10 and press 237 Enter the new base 4 The number 237 in base 4 is 3231 Base Conversion Utility --- Menu <1> Convert from base 10 to a user-specified base <2> Convert from a user-specified base to base 10 <3> Quit Enter your choice and press 2 Enter the number to be converted and press 3231 Enter the base of the number 4 Converting to base 10 we get: 3 * (4 ** 3) = 192 2 * (4 ** 2) = 32 3 * (4 ** 1) = 12 1 * (4 ** 0) = 1 The base 10 value is 237 Base Conversion Utility --- Menu <1> Convert from base 10 to a user-specified base <2> Convert from a user-specified base to base 10 <3> Quit Enter your choice and press 3 Assumptions =========== Numbers to be converted are between 0 and 1000 inclusive. Number bases can range from base 2 to base 10 inclusive. All numbers are to be read as integers. All data read is of type integer. For option 2, the user supplied number is in the appropriate base. Test Set ======== Input Output Option Number Base 1 237 4 3231 2 2332 4 190