{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

c08_ps04_sol

c08_ps04_sol - C8-1 Algorithm 1 Use a subtype to represent...

This preview shows pages 1–2. Sign up to view the full content.

C8-1 Algorithm 1. Use a subtype to represent the numbers for months 2. Use an enumeration to represent the named months 3. Use an enumeration to represent the roman months 4. Get the inputs from the user 5. Convert the month into roman and named formats using a. New_Type_Package’Val(Month_Type’Pos(Month) –1); 6. Display the months in all three formats to the user. Note: The enumerations range from 0 to (number_of_elements_in_Enumeration –1). Code Listing GNAT 3.13 p ( 20000509 ) Copyright 1992 - 2000 Free Software Foundation, Inc. Compiling: c:/docume~ 2 /jk/desktop/ 16070 /codeso~ 1 /translate_dates.adb (source file time stamp: 2003 - 09 - 24 01 : 35 : 00 ) 1 . -------------------------------------------------------------------- 2 . -- Program to accept different date formats 3 . -- Programmer : Jayakanth Srinivasan 4 . -- Date Last Modified : 09-23-2003 5 . -------------------------------------------------------------------- 6 . 7 . with Ada.Text_Io; 8 . with Ada.Integer_Text_Io; 9 . 10 . procedure Translate_Dates is 11 . --use a subtype to limit the date to be between 1 and 31. 12 . subtype Date_Type is Integer range 1 .. 31 ; 13 . -- use a subtype to limit the month to be between 1 and 12 14 . subtype Month_Type is Integer range 1 .. 12 ; 15 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern