Posted by Glenn Stewart on March 14, 2005 I am very much a beginner at programming, and i am having huge amounts of trouble with the following two tasks. my email is glenn@bizoo.com.au if you would like to help. It would be greatly appreciated. Program 1 Design an algorithm that will prompt for and receive the time expressed in 2400 format (eg 2305 hours), convert it to 12 hour format (eg 11:05 pm.) and display the new time on the screen. Your program is to repeat the processing until six times have been entered, processed and displayed. Execution of the program may proceed as follows: Enter time to convert in 24 hour format -> 2305 2305 is equivalent to 11:05 pm. Enter time to convert in 24 hour format -> 925 0925 is equivalent to 9:25 am. Enter time to convert in 24 hour format -> 1200 1200 is equivalent to 12:00 pm. Note 12 midday is pm Enter time to convert in 24 hour format -> 5 0005 is equivalent to 12:05 am. .and so on until 6 times have been processed. For the purpose of this exercise, you may assume that only valid input is presented to the program. That is, you are not required to do any error checking for invalid input. You are to use a For loop to control the repetition. A Total of n calculations has been processed. Program completed Press [ENTER]
. For this program you are required to trap invalid integer values for hours, minutes, seconds and the value for morning/afternoon. You may assume that only integer input will be used i.e. no real values or character data will be entered. Design an algorithm that will prompt for and receive the time expressed in 2400 format (eg 2305 hours), convert it to 12 hour format (eg 11:05 pm.) and display the new time on the screen. Your program is to repeat the processing until six times have been entered, processed and displayed. Execution of the program may proceed as follows: Enter time to convert in 24 hour format -> 2305 2305 is equivalent to 11:05 pm. Enter time to convert in 24 hour format -> 925 0925 is equivalent to 9:25 am. Enter time to convert in 24 hour format -> 1200 1200 is equivalent to 12:00 pm. Note 12 midday is pm Enter time to convert in 24 hour format -> 5 0005 is equivalent to 12:05 am. .and so on until 6 times have been processed. For the purpose of this exercise, you may assume that only valid input is presented to the program. That is, you are not required to do any error checking for invalid input. You are to use a For loop to control the repetition. A Total of n calculations has been processed. Program completed Press [ENTER]... For this program you are required to trap invalid integer values for hours, minutes, seconds and the value for morning/afternoon. You may assume that only integer input will be used i.e. no real values or character data will be entered. Related Articles and Replies
|