C++ console application to access sunrise/sunset almanac data for up to 30 days for a given cities - 73650

Solution Posted by


Rating : (19)A+
Solution Detail
Price: $20.00
Request Description

Week 1 - Files will be included in the folder.


Practice A: http://www3.delta.edu/teklingl/cst280/practice/CST280W01a.pdf

Practice B: http://www3.delta.edu/teklingl/cst280/practice/CST280W01b.pdf 

Program 1:  Everything below.





To build a complete working C++ program to review basic C++ concepts focusing on multi-file C++ applications, input files, and strings.




Write a program to create a console application that allows the user to access sunrise/sunset almanac data for up to 30 days for a given choice of cities.


Read the data from the file cityinfo.txt into one or more arrays. This will be the set of cities the use can choose from. Your program should first prompt the user for a city airport code (such as MBS). If information is not available for this city, provide feedback to the user and terminate the program.


If this city is in the list of available cities, access the geographical coordinates (latitude, longitude) and time zone code (E-eastern, C-central, M-mountain, P-pacific). If the city code is valid and in the list, next prompt the user for a calendar date in a coded form of such as 20130831 (for August 31, 2013). If the date is invalid, inform the user. Do not allow them to continue until they have entered a valid date. Next, prompt the user for a number of days to write. This value must be in the range 1 and 30. An error message should be displayed if the number is not. For any input errors, be sure that no output is generated until all input data are valid.


Finally add a feature that will automatically calculate if daylight savings time is active for the the current date in focus. This is required as a parameter for the primary function used to calculate sunrise/sunset. At least one function in the provided calendar date function set can help with this determination. Daylight Savings Time (DST) in the United States:


    begins at 2:00 a.m. on the second Sunday of March

    ends at 2:00 a.m. on the first Sunday of November


Your program should then generate a list sunrise/sunset data for the given city and date range. Example output could be (MBS for 7 days starting 20130831):


    Sunrise/sunset data for MBS

    SAT 31 AUG 2013 Rise: 7:00am Set: 8:13pm

    SUN 01 SEP 2013 Rise: 7:01am Set: 8:12pm

    MON 02 SEP 2013 Rise: 7:02am Set: 8:10pm

    TUE 03 SEP 2013 Rise: 7:03am Set: 8:08pm

    WED 04 SEP 2013 Rise: 7:04am Set: 8:06pm

    THU 05 SEP 2013 Rise: 7:05am Set: 8:05pm

    FRI 06 SEP 2013 Rise: 7:06am Set: 8:03pm


Include the correct day of the week name for the dates you include in the report (i.e. MON, TUE, etc.). Also include insure that all day numbers are two digits as shown in the example. Be sure that your date range correctly rolls into the next month and/or year, if necessary. Finally, include a feature that will give the user a Do you wish to continue prompt that will allow them to enter another city and/or date range. Using arrays for the city information will allow you to simply enter another array/list search instead of closing and reopening the input file.


Your program should utilize the following tools:


    File cityinfo.txt: A list of city airport identifiers with geographical coordinates (latitude first, then longitude, then time zone).

    sun.h and sun.cpp: Primary function for calculating sunrise and sunset from a date and geographical coordinate.

    datefun.h and datefun.cpp: Several relevant date processing algorithms.


Note: You have formal permission to use all instructor-provided functions provided credit is given within comments in your code as as long as the provided functions are unchanged.


Design your application using guidelines to maximize modularity, reusability, and maintainability. Utilize the "sun" and "date" functions in their current form - as external function sets that will be included into your main "driver" program for this application.




Deliver the following to the online course management system as your final product:


    Upload One PDF document containing:

        Source code files (.cpp and/or .h files; only those build/changed by you)

        Output demonstrating the following tests cases:

            MBS 20130831; for 7 days (validating the example above)

            LAX; 20131116; for 3 days

            DEN 20141015; for 30 days

            LAF 20131225; for 10 days

            FWA; for any date (expecting an error message for city)

            DFW; for 20130931 (expecting an error message for invalid date)

            LAN; 20160229; for 40 days (expecting an error message day range value)

    Upload all program source code (.cpp and .h files) for the assignment


Solution Description