Question: I need the program written in C# . Problem Specification: Write a program to merge arrays containing occurrence data for the pink moon. Your program
. Problem Specification:
Write a program to merge arrays containing occurrence data for the pink moon. Your program should begin with the following prompt, using the symbolic constant of your name provided in the program header file, lab9.h: PINK MOON PROGRAM WRITTEN IN C This program was written by Sharon Software.
How do you want to see the data sorted?
Your program should allow the user to display the dates in whichever order they choose:
Year Date in April Time of day
You should prompt the user if they want the data ascending or descending.
Tasks:
1. Use a header file for this specific lab assignment. Call it
pink_moon.h
2. Place the following lines into the header
#ifndef PINK_MOON_H
#define PINK_MOON_H
int year_markers[] = { 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, }; int day_markers[] = { 18, 6, 25, 15, 4, 22, 11, 30, 19, 8, }; int time_markers[] = { 244, 1919, 1957, 742, 1206, 524, 608, 58, 1112, 235, }; char *day_of_week_markers[] = { "Mon", "Fri", "Thu", "Tue", "Sat", "Fri", "Tue", "Mon", "Fri", "Sat", };
#endif
3. The following is a sample program that uses the pink_moon.h header file and prints out some test data.
#include
void print_full_table( int [], int [], int [], char **, int n );
int main() {
}
print_full_table( year_markers, day_markers, time_markers, day_of_week_markers, 4 );
return EXIT_SUCCESS;
void print_full_table( int year[], int day[], int time[], char **dow, int n ) {
int i;
for ( i = 0; i
}
return; }
int mm = time[ i ] - hh * 100; printf( "%d. %d %2d %2.2d:%2.2d %s ", i+1, year[ i ],
day[ i ], hh, mm, dow[ i ] );
}
return; }
4. You can use the following command at the Linux prompt to download the header file and the sample program from Github, a version control repository commonly used by programmers.
git clone https://github.com/untamedspud/lab9-spring2017.git
Confirm that this code compiles and runs successfully, and that you understand what it does, before you continue on with your program.
git clone https://github.com/untamedspud/lab9-spring2017.git
You can rename the pnkmoon.c file to be lab9.c and build on it from there if you would like.
5. Prompt the user to sort the data so that this interaction would work:
How do you want to see the data sorted? [1byyear, 2bydayinApril
3bytimeofday, 4- exit] ?
2 Ascending[1] or descending[2] order? 1
Blue Moon Dates by day in April,
Ascending
1. Mon, April 30, 2018 at 00:58.
2. Sat, April 8, 2020 at 02:35.
3. Mon, April 18, 2011 at 02:44.
4. Fri, April 22, 2016 at 05:24. .
. .
How do you want to see the data sorted? [1byyear, 2bydayinApril
3bytimeofday, 4- exit] ?4 Goodbye.
6. Create a function to sort the data in the parallel arrays using the selection sort.
void sort_parallel_arrays( int arr[], int idx[], int n, ordering a );
The first argument, arr, is the array containing the data to be sorted. The second argument is an index, used to indicate what the sequence is through the data after the array is sorted. The third argument, n, is the number of elements in the arrays arr and idx. The fourth element represents ascending or descending.
The idx array should be prepopulated with the numbers 0 through n, representing the ordering of the array arr as it is passed in to the function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
