$20 Bonus + 25% OFF
Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!
Students Who Viewed This Also Studied
UFCFF6301 Programming in C++
Questions:
Objective:
Students will display their knowledge of sorting algorithms and memory management functions (and previous course topics) in programming using a real-world example.
Problem:
You are the financial manager of a robot development design team on campus. Recently, the team sent you requests for certain parts to complete their design prototype. These part orders have been pooled into a single file, which contains the total number of different parts to be ordered on the first line. On subsequent lines, the following information is given for each different part: the part serial number, the price of ordering a single unit of that part, and the number of units to be ordered. This information is provided in that order, separated by spaces. A visualization of the file layout is shown below.
2
4913 26.41 9
8057 13.70 14
As the financial manager, you want to analyze the total price of ordering all the different parts to make sure your team stays on budget. To do this, you have decided to calculate the total price of ordering all units for each part, reorganize them in increasing total price, and store the sorted list in its own file for convenient viewing. (Hint: the total price can be determined by multiplying the price of a single part unit by the number of units to order.) This new file will have a title on the first line displaying what each column represents. The subsequent lines will provide the same information as in the original file, but containing the total price value for that part. A visualization of this layout is shown below.
Serial / Price / Units / Total
8057 13.70 14 191.80
4913 26.41 9 238.41
For this assignment, you will be both outputting the final parts list to the console to review immediately, as well as saving it to a file for later reference!
Instructions:
Write a program in C to performing the following tasks:
Open and read the first line of the file “parts.txt” to get the number of different parts.
Create an array to hold all of the parts information (including an additional column for the total prices) using the malloc function.
Read all the parts information from the file into the first three columns of your array.
For each different part, calculate the total price of ordering all units of that part and store that value in the fourth column of the array.
Output the contents of your array to the console. You can use the Example Output Code section to help you do this.
Sort the different parts in increasing order of total order price. Make sure you move all row elements when performing swaps!
Output the contents of your sorted array to the console using the format shown in the sample output below (including the heading line).
Store the finished array in a new file named “orders.txt”, with the format shown above.
Use the free function to free the memory associated with your parts array.
Comments are mandatory for this assignment. Add comments as necessary for important parts of your code, such as memory allocation, repetition or selection structures, or function calls to explain what the program is doing.
Both your output and your “orders.txt” file must match the sample below as closely as possible; otherwise, the autograding software will not be able to grade your assignment, which may affect your mark.
Sample Input & Output:
Displayed below is a sample “parts.txt” file that you can create and use for testing your program. Note that this .txt sample is also available on OnQ attached to the assignment.
8
5847 95.58 9
6162 44.94 9
3068 48.77 19
5614 34.00 15
9060 80.13 14
2292 79.38 3
8197 67.19 19
6689 66.62 3
Displayed below is a sample output based on the above file contents. Note that the “orders.txt” file created by your program will be identical to the second half of this output – containing the heading line and the sorted parts data.
5847 95.58 9 860.22
6162 44.94 9 404.46
3068 48.77 19 926.63
5614 34.00 15 510.00
9060 80.13 14 1121.82
2292 79.38 3 238.14
8197 67.19 19 1276.61
6689 66.62 3 199.86
Serial / Price / Units / Total
6689 66.62 3 199.86
2292 79.38 3 238.14
6162 44.94 9 404.46
5614 34.00 15 510.00
5847 95.58 9 860.22
3068 48.77 19 926.63
9060 80.13 14 1121.82
8197 67.19 19 1276.61
Submission Instructions:
You can either utilize the Mimir IDE found here to create and submit your program, or create your program using CLion and upload it here for grading. Your program file must be named “apsc143assign7.c” in order for your assignment to be graded. Do not include any personal information (student number, name, etc.) in your submission.
Refer to the assignment rubric on OnQ for a detailed breakdown of the grading criteria. Your submission must adhere to the assignment rules as outlined in the submission policy document for this course, which can also be found on OnQ. There is zero tolerance for plagiarism in this course. This autograding software will automatically flag potential cases of plagiarism, which will be reviewed by the instructors.
More information on both assignment submissions and the specific definition and repercussions of plagiarism can be found in the “Begin Here (About This Course)” module on OnQ in the “Assignments” and “Plagiarism” videos, respectively.
Example Output Code:
The below code can be used to output the contents of an array to the console with the required format for this assignment. Note that the parts array used here will have a number of rows equal to the integer numParts.
UFCFF6301 Programming in C++
Answer in Detail
Solved by qualified expert
Get Access to This Answer
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.
Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.
31 More Pages to Come in This Document. Get access to the complete answer.
MyAssignmenthelp.com is the only cheapest essay writing service in Australia that maintains academic standards while providing essay assignment help. Unlike other essay writing companies, we do make false promises. We keep our prices low, so that students can avail top-quality essay homework help at an affordable price. Students can get cheap MBA essay writing services by completing only three simple steps. Contact us now!
More UFCFF6301 UFCFF6301 Programming in C++: Questions & Answers
CPSC 5710 Microcomputer Systems Architecture
Task
Instructions In the final project, you have the opportunity to develop the project you proposed in module 6. Your project must contribute and bring value to a business or individual(s).
What to Submit? For the final project, you will submit the following: Word or PDF document containi …
View Answer
KIT107 Programming
his assignment is to be completed in pairs. The assignment is due at 3PM Wednesday August 11th 2021 and should be completed with a partner. You and your partner should work together on all of the design and programming. It should be done using the pair-programmingmethodology and not by division of l …
View Answer
Business Management
In this assignment you will learn how to: 1. use top-down design to divide a larger data processing task into parts; 2. use Python to read and write text files; 3. use functions to raise the abstraction level of your program; 4. use string and list methods to generate HTML. …
View Answer
COMP5426 Parallel and Distributed Computing
This assignment consists of two parts: Pairwise Inner Products of Vectors: Consider N vectors, each being of length M, which can be stored in a 2D matrix of size N by M . Pairwise inner products of vectors are to calculate inner products of all possible pairs of vectors. For N vectors there are N*(N …
View Answer
Content Removal Request
If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the
content removal request.
Choose Our Best Expert to Help You
Jace Brights
post graduation degree from the University of Oxford.
850 – Completed Orders
Hire Me
Ke Wei
Master of Applied Information Systems with Specialization in Database Management
145 – Completed Orders
Hire Me
Maxwell West
Master of Psychology with Specialization in Neuropsychology
1490 – Completed Orders
Hire Me
Still in Two Minds? The Proof is in Numbers!
33845 Genuine Reviews With a Rating of 4.9/5.
Economics
Home Work: 3500 Pages, Deadline:
3 days
well written, i scored well in exam, thanks to the expert who answered all my questions on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Home Work: 12 Pages, Deadline:
5 days
thanks for your support. very well written and answered all questions but some answers were submit late so i didnt upload
User ID: 7***15 Adelaide, Ecuador
Accounting
Assignment: 7 Pages, Deadline:
2 days
very well written, answered all questions correctly and submited on time, the management is really good
User ID: 7***15 Adelaide, Ecuador
Finance
Course Work: 7 Pages, Deadline:
4 days
very well writen and answered all questiones, the graphs and answers are all correct. submited on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Essay: 4 Pages, Deadline:
23 hours
well written, good referencing, submited on time, very reliable and less plagrism, i manage to score grade C
User ID: 7***15 Adelaide, Ecuador
Maths
Home Work: 1 Page, Deadline:
4 days
Great work, got a good grade on this assignment. I am very happy with the end result, thank you.
User ID: 4***77 United States
Mechanical Engineering
Home Work: 2 Pages, Deadline:
5 days
Good work and effort with this quick turnover assistant . Will use them again next time
User ID: 7***81 Perth, Australia
Civil Law
Essay: 2.4 Pages, Deadline:
10 hours
Thank you very much. I have an A. I will highly recommend your service to my friends. Your work is excellent, and your service is trustworthy.
User ID: 8***80 United States
Marketing
Assignment: 2 Pages, Deadline:
3 days
Thank you everything looks amazing. I will let you know what grade I get. Thanks so much
User ID: 6***39 Round Rock, United States
Civil Engineering
Programming: 2 Pages, Deadline:
4 days
Absolutely Awesome!!! This was done perfectly and tutor very easy to work with. Thank you so much
User ID: 6***39 Round Rock, United States
Economics
Home Work: 3500 Pages, Deadline:
3 days
well written, i scored well in exam, thanks to the expert who answered all my questions on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Home Work: 12 Pages, Deadline:
5 days
thanks for your support. very well written and answered all questions but some answers were submit late so i didnt upload
User ID: 7***15 Adelaide, Ecuador
Accounting
Assignment: 7 Pages, Deadline:
2 days
very well written, answered all questions correctly and submited on time, the management is really good
User ID: 7***15 Adelaide, Ecuador
Finance
Course Work: 7 Pages, Deadline:
4 days
very well writen and answered all questiones, the graphs and answers are all correct. submited on time
User ID: 7***15 Adelaide, Ecuador
Marketing
Essay: 4 Pages, Deadline:
23 hours
well written, good referencing, submited on time, very reliable and less plagrism, i manage to score grade C
User ID: 7***15 Adelaide, Ecuador
Maths
Home Work: 1 Page, Deadline:
4 days
Great work, got a good grade on this assignment. I am very happy with the end result, thank you.
User ID: 4***77 United States
Mechanical Engineering
Home Work: 2 Pages, Deadline:
5 days
Good work and effort with this quick turnover assistant . Will use them again next time
User ID: 7***81 Perth, Australia
Civil Law
Essay: 2.4 Pages, Deadline:
10 hours
Thank you very much. I have an A. I will highly recommend your service to my friends. Your work is excellent, and your service is trustworthy.
User ID: 8***80 United States
Marketing
Assignment: 2 Pages, Deadline:
3 days
Thank you everything looks amazing. I will let you know what grade I get. Thanks so much
User ID: 6***39 Round Rock, United States
Civil Engineering
Programming: 2 Pages, Deadline:
4 days
Absolutely Awesome!!! This was done perfectly and tutor very easy to work with. Thank you so much
User ID: 6***39 Round Rock, United States