subject
Computers and Technology, 01.05.2021 19:50 mccdp55

For this assignment you will write a program that reads in a list of job assignments, puts them in a calendar and generates a report. The report
includes the day-by-day calendar assignments as well as a list of errors from
the data.
The objective of this assignment is to practice using the following concepts:
- reading data from a file
- structs
- arrays
- character arrays for strings
- user-defined functions
- multiple files for compilation
Your program will be evaluated based on both how it runs as well as how it was
designed and coded.
Along with these instructions, I have provided data files and the EXACT
expected output that corresponds to some of those data files. It is important
that your program output matches EXACTLY. This includes spelling, whitespace,
and punctuation.
The rest of this document provides more details about the assignment.

Details
The following sections provides details about the requirements for the
assignment.
data storage
As described in the overview, this program reads in data and needs to store it
in a calendar. This means that we need to have variables to store this
data. The central structure is going to be the calendar. Since the calendar
has a fixed number of days (CAL_DAYS from the sizes. h file), we can use an
array with that number of slots.
The next question is what type of data should be in the array. Each day needs
to hold task information for up to three assignments. The task information
includes the task name, the duration of the task, and who it's assigned
to. The best option for this is to use a struct.
Putting these two items together, that means you have an array of structs. If
your struct was defined as "struct day { ...stuff... };" then declaring the
calendar array would look like this:
day calendar[CAL_DAYS];
That creates an array called "calendar" that holds "day" variables. It holds
CAL_DAYS of those variables.
The data we are dealing with it presented as strings
Since the report requires us to print out errors, we will probably want to
have some arrays to keep the errors. Since errors are strings and strings are
character arrays, we will end up with something like this:
char overlapErrors[MAX_ERRS][MAX_STR]; That is, an array that holds at most MAX_ERRS error messages and each message
is at most MAX_STR characters long.
Now that we have a concept of the variables that we'll use, we can look at the
main algorithm.
main
The main algorithm has two phases. In the first phase, the assignment data is
read from the input file and inserted into the calendar array. Since each day
in the array can only hold up to three assignments, if more than three
assigments are provided for a day, the program keeps track of the extra ones
so it can report an error at the end and it DOES NOT insert them into the
calendar.
The format of the data in the input file is:
;;;
For example:
5;Replace ventalation filters;2;Robbie Mitchell
Any blank lines in the data file should be ignored and any line starting with
a # should be ignored.
The data in the input file can not be assumed to be in any sort of order. You
do not have to deal with an improperly formatted data file.
The second phase of the main algorithm generates the calendar and prints the
errors. See the assignments. txt. out for the exact format of this output. Your
program needs to print the data in the exact same way.
One more thing, since you may not have dealt with command line arguments
before, I have provided a sample_main. cpp file that shows how to make sure
that a filename is passed on the command line and how to get that
filename.
reading data
Reading the data from the file requires following this process:
- read a line from the file (the whole line)
- get the day number part
- get the task name
- get the duration
- get the who name
- add that data to the correct day entry in the calendar
Getting the individual parts of the line of input will require you to have
another variable to copy the data into and then you will use a loop to go one
character at a time over the original line of data, copying one character at
a time until you hit the delimeter. Here's an example of doing something
similar. In this example I'm copying the xth through yth characters from "line" into
"other".
char other[MAX_STR];
int otherIdx = 0;
for (int i=x;i<=y;i++) {
other[otherIdx] = line[i];
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Write a function so that the main program below can be replaced by the simpler code that calls function original main program: miles_per_hour = float( minutes_traveled = float( hours_traveled = minutes_traveled / 60.0 miles_traveled = hours_traveled * miles_per_hour print('miles: %f' % miles_traveled) sample output with inputs: 70.0 100.0 miles: 116.666667
Answers: 3
question
Computers and Technology, 22.06.2019 22:50
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
question
Computers and Technology, 23.06.2019 06:00
How can a user delete a drawing object
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
You know the right answer?
For this assignment you will write a program that reads in a list of job assignments, puts them in...
Questions
question
Advanced Placement (AP), 21.12.2020 16:40
question
English, 21.12.2020 16:40
question
English, 21.12.2020 16:40
question
Mathematics, 21.12.2020 16:40
question
Advanced Placement (AP), 21.12.2020 16:40
Questions on the website: 13722360