, , , , , , ,

[SOLVED] Csci 2275 programming and data structures assignment 1

$25

File Name: Csci_2275_programming_and_data_structures_assignment_1.zip
File Size: 508.68 KB

5/5 - (1 vote)

Please read the entire assignment carefully before beginning. In this assignment, you’re going
to develop a simulated message board that monitors items wanted and items for sale and looks
for matches. When a match is found, e.g. there is a bike for sale for $50 and a bike wanted,
where the buyer will pay up to $60, then the item is removed from the message board.There is a file on Canvas called items.txt that includes up to 100 wanted or for sale items in five
categories: bike, microwave, dresser, truck, or chicken. Each line in the file is one item. There is
also a driver file that opens the file, reads each line, and uses an array of structs to store the
items. The driver code assumes there will never be more than 100 lines in the file, therefore, the
array of structs has a fixed size of 100 to represent the items available on the message board.
Each struct represents an item and has a type, such as bicycle or truck, a price, and whether it
is for sale or wanted. (The for sale or wanted is represented as a Boolean, where 0 is for sale
and 1 is wanted.)The data in the file is read into the array by the driver program, your program needs to read the
array and check if there is a match between the existing items in the message board. There are
two options to consider:
Match is not found in the new arrayIf a match is not found in the array, print the information about the unmatched item using the
commands:
cout<<”Match not found”<<endl;
cout<<itemArray[x].type<<” “<<itemArray[x].price<<endl;
Match is found in the new arrayIf a match is found in the new array, use the best match found, and remove the matched items
from the array and shift the array to fill the gaps left by the removed items. (Section 3.2.4 of your
data structures e-book shows the algorithm for deleting an item from an array and shifting.) Print
the action performed, using the command:cout<<itemArray[x].type<<” “<<itemArray[x].price<<endl;
where itemArray is the array of structs and x is the index where the for sale item was found in
the array. The type is one of the following: bike, microwave, dresser, truck, or chicken. The
price is the actual item cost, not what the user is willing to pay.Other things your program needs to do
Use two definitions for best match
Your program needs to generate two different ways of finding the best match. In the first
approach, you need to find the maximum profit for the seller. In the second approach, you need
to find the maximum bargain for the buyer.Your program should have a separate function for maximum profit and maximum bargain. Your
code in main should run both of these approaches. During your grading meeting with your TA,
be prepared to comment on the differences in the code and in the output produced.
How to know if your output is correct?There is a Piazza forum for this class and you are welcome to post the output you get for the
garageSale.txt file on Piazza and ask if other students get the same answer. If you want to test
your code with a smaller data set, create a new .txt file and use that file as the input file when
you run your code. Please don’t post your code on Piazza.I will talk about structs in class on Friday. For more information on what structs are and how to
create them, there are videos on the CU Boulder Data Structures CSCI 2270 YouTube channel
that describe structs in more detail. The videos are Data Structures Tutorial 9 and 10.Submit your assignment to Canvas
Submit your .cpp file through Canvas using the Assignment 1 Submit link. Make sure your code
is commented enough to describe what it is doing. Include a comment block at the top of the
.cpp file with your name, assignment number.
What to do if you have questions
There are several ways to get help on assignments in 2275, and depending on your question,
some sources are better than others. There is a discussion forum on Piazza that is a good place
to post technical questions, such as how to shift an array. When you answer other students’
questions on Piazza, please do not post entire assignment solutions. If, after reading the
assignment write-up, you need clarification on what you’re being asked to do in the assignment
ask the TA or the Instructor. We will be monitoring Piazza regularly.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Csci 2275 programming and data structures assignment 1
$25