# stuck on my assignment (very beginner)

 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 1Design 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 -> 23052305 is equivalent to 11:05 pm.Enter time to convert in 24 hour format -> 9250925 is equivalent to 9:25 am.Enter time to convert in 24 hour format -> 12001200 is equivalent to 12:00 pm. Note 12 midday is pmEnter time to convert in 24 hour format -> 50005 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. Program 2Write a Delphi program that accepts an hour, a minute, a second, and a whole number representing morning or afternoon, (0 = morning and 1 = afternoon). The program will then calculate and print the number of seconds elapsed from midnight up to the time that was entered. Your program will continue running until a value of 0 (zero) is entered for the hour value. Use 12,0,0,0 to represent midnight, and 12,0,0,1 to represent 12 midday (noon). So for data values of 12 0 2 0, the number of elapsed seconds will be shown as 2 seconds. After the terminating value has been entered, the program will display a summary message indicating the number of times processed: A Total of n calculations has been processed. Program completed  Press [ENTER]. (where n is the count of times entered excluding the termination value)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. 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 -> 9250925 is equivalent to 9:25 am.Enter time to convert in 24 hour format -> 12001200 is equivalent to 12:00 pm. Note 12 midday is pm Enter time to convert in 24 hour format -> 50005 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. Program 2Write a Delphi program that accepts an hour, a minute, a second, and a whole number representing morning or afternoon, (0 = morning and 1 = afternoon). The program will then calculate and print the number of seconds elapsed from midnight up to the time that was entered. Your program will continue running until a value of 0 (zero) is entered for the hour value. Use 12,0,0,0 to represent midnight, and 12,0,0,1 to represent 12 midday (noon). So for data values of 12 0 2 0, the number of elapsed seconds will be shown as 2 seconds. After the terminating value has been entered, the program will display a summary message indicating the number of times processed:A Total of n calculations has been processed. Program completed  Press [ENTER]... (where n is the count of times entered excluding the termination value)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 Re: stuck on my assignment (very beginner) Jenny 3/14/2005 Re: stuck on my assignment (very beginner) glenn 3/16/2005 Delphi Console Applications John, DelphiLand Team 3/16/2005 Delphi console applications Jenny 3/16/2005 Re: stuck on my assignment (very beginner) Al 3/16/2005 Re: stuck on my assignment (very beginner) Glenn 3/17/2005