Sale!

COP 3223 Assignment 5 Introduction to C Programming

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (1 vote)

Objectives

1. To learn how to read input from a file
2. To reinforce knowledge of loops and conditionals

Introduction: Programmers for a Better Tomorrow

Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical
societies, and scholarship organizations manage various tasks so that they can focus on making
the world a better place! They have asked you and your classmates to help them develop some
new programs to benefit their organizations.

Problem: Silent Auction Fundraiser (auction.c)

Programmers for a Better Tomorrow is hosting a silent auction to benefit one of their main
charities. Participants in a silent auction write down which item they are bidding for and how
much they are willing to bid.

This program will read from a file that contains a list of bids on a number of auctions. The
program must determine the amount that each item will be sold for. This will be the highest
amount that someone is willing to bid on that item.

When the final bid amount for each item has been determined, print this information to the
screen.
Finally, calculate the total amount of money made for the auction (the sum of the final bids of
each item) and print this information to the screen.
Arrays are not required (except for the name of the input file), but may simplify your solution.

Input Specification

The file name will be a string less than 30 characters in length. There will be no other input from
the user.

Input File Specification
The first line of the file will contain a single positive integer, n (n <= 10), representing the
number of items up for auction. Information about each auction follows.
The first line of each auction will contain a single positive integer, k, representing the number of
bids on that item. Following this value there will be k integers, in any order, that represent the
individual bids on that item in dollars.

Output Specification

Output to the screen. For each auction, print the following:
2
Auction #A was sold for $X.XX!
where A is the number of the auction and X is the highest bid for that auction.
At the end of the program, print the total amount of money the auction raised:
The silent auction raised $Y.YY for charity!

Sample Run
Below is a sample output of running the program. Note that this sample is NOT a
comprehensive test. You should test your program with different data than is shown here based
on the specifications given above.
In the sample run below, for clarity and ease of reading, the user input is given in italics while
the program output is in bold. (Note: When you actually run your program no bold or italics
should appear at all. These are simply used in this description for clarity’s sake.)
Sample Input (input.txt)
5
4
100 500 250 300
1
700
3
300 150 175
2
920 680
8
20 10 15 25 50 30 19 23
Sample Output
Please enter the name of the file.
input.txt
Auction 1 was sold for $500.00!
Auction 2 was sold for $700.00!
Auction 3 was sold for $300.00!
Auction 4 was sold for $920.00!
Auction 5 was sold for $50.00!
The silent auction raised $2470.00 for charity!

Deliverables
One source file – auction.c – is to be submitted over WebCourses.

Restrictions
Although you may use other compilers, your program must compile and run using Code::Blocks.
Your program should include a header comment with the following information: your name,
3
course number, section number, assignment title, and date. Also, make sure you include
comments throughout your code describing the major steps in solving the problem.

Grading Details
Your programs will be graded upon the following criteria:
1) Your correctness
2) Your programming style and use of white space. Even if you have a plan and your program
works perfectly, if your programming style is poor or your use of white space is poor, you could
get 10% or 15% deducted from your grade.

3) Compatibility – You must submit C source files that can be compiled and executed in a
standard C Development Environment. If your program does not compile, you will get a sizable
deduction from your grade.