Sale!

CSE 1320 Intermediate Programming Assignment 5 solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (5 votes)

This assignment focuses on using command line arguments and file I/O.
1. Create a program that copies the data from one file to another while converting all
lowercase vowels to uppercase vowels. Your program should accept two arguments:
an input file to read from and an output file to copy to.
• Your program should check to make sure the output file does not already exist.
If it does, print “DESTINATION FILE EXISTS.” to stdout.
• Print the number of characters changed to stdout using the format string
“%d characters changed.”
• Save your code as prob1.c.
Example Run
$ ./a.out input.txt output.txt
128 characters changed.
2. Create a program that reads a file of 2D coordinates and calculates the bounding
box and center of the bounding box. The bounding box is defined as the minimum
area that fully encompasses all the coordinates. The center of that bounding box is
calculated by taking the mean of the bounding box coordinates: (
x1+x2
2
,
y1+y2
2
).
• Use file keypoints.txt on Canvas->Modules for an example of what the input
data will look like.
• If the input file cannot be opened, warn the user by printing “CANNOT OPEN FILE.”
to stdout.
• Print the resulting bounding box and center to stdout using the format string
%.2f,%.2f,%.2f,%.2f,%.2f,%.2f, following the pattern
xmin, ymin, xmax, ymax, xcenter, ycenter.
• Save your code as prob2.c.
Example Run
$ ./a.out keypoints.txt
0.00,0.00,100.00,100.00,50.00,50.00
3. Create a program that parses a CSV file of product data and prints the items with
a price that is less than or equal to that input by the user.
CSE 1320: Assignment 5
• Use file prices.csv on Canvas->Modules for an example of what the input
data will look like.
• Your program should take two arguments: an input file to process and a price
limit.
• Print only the names of each item to stdout that have a price less than or
equal to the given limit.
• If the given file does not exist or cannot be opened, warn the user by printing
“CANNOT OPEN FILE.” to stdout.
• Save your code as prob3.c.
Example Run
$ ./a.out prices.csv 199.99
MSI X470 Gaming Plus
Corsair DDR4 Memory
4. Create a program that filters the data in a CSV file of product data based on some
search word and prints the resulting output to a new file. Additionally, the program
will print the number of items filtered to stdout.
• Use file prices.csv on Canvas->Modules for an example of what the input
data will look like.
• Your program should take three arguments: an input file to process, an output
file to save the results, and a search word.
• If the output file already exists or cannot be opened, warn the user by printing
“CANNOT OPEN FILE.” to stdout.
• If a raw CSV line in the input file contains the word given by the user, that
raw line must be copied to the new file AS IS.
• Print the number of items found to stdout using the format string
“%d item(s) returned.\n”
• Save your code as prob4.c.
Example Run
$ ./a.out prices.csv filter.csv Intel
4 item(s) returned.
Create a zip file using the name template LASTNAME_ID_A5.zip which includes the all
required code files. Submit the zip file through Canvas.
2