In: C Programming
25 Feb 2012Problem:
The program would require you to make two tables: Donations Table and Request Table. Each table will have two attributes: the Inventory Type, which is what type of food item it is, e.g., Milk, Meat, etc., and the Amount, which is the amount of that food item, e.g., 20, 30, etc. Note: For simplification, no units for amounts are considered.
Functionality Specification
1. Add donations and requests to the tables.
2. For any new donation that comes in check if any donation is present in the donations table with same inventory type; if there is one then increase its amount by the new donation amount, and do not add a new entry in the donations table. If not, then add a new entry in the donations table for that donation.
3. Remove a request from the request table when it is fulfilled.
4. If for a request the request amount is greater than the amount present, then partially fulfill that request by the amount present. And do not delete that request from the request table; just reduce its amount by the amount that is fulfilled.
5. If in the process of fulfilling the request, the amount present for any donation becomes zero, then remove that donation from the donations table.
6. Print the status report, containing stock currently available and requests that are not yet fulfilled.
7. When the option is to Fulfill a Request, you are to only process the one request that is at the top of the Request Table (the oldest request). Thus, if it cannot be fulfilled, it will stall the system, until someone donates enough, so it can be satisfied later.
Input/Output Specification
At the beginning, the program should present the user with the available options, and ask for his/her preference. Based on the preference, the program should perform the corresponding task.
The user will have five choices:
1. Enter a Donation
2. Enter a Request
3. Fulfill the earliest Request
4. Print status report
5. Exit
When the user selects ‘1’, the program should ask the user for the inventory type and amount of the donation to be made. When the donation has been added to the donations table, the program should notify the user by printing out “Donation Added”.
When the user selects ‘2’, the program should ask the user for the inventory type and amount of the request to be made. When the request has been added to the requests table, the program should notify the user by printing out “Request Added”.
When the user selects ‘3’, the program should print “Request Fulfilled” if the request is completely fulfilled, print “Cannot be Fulfilled” if there is no donation of that type, and print
“Partially Fulfilled” if the donation type exists, but cannot completely satisfy the request.
If a request is fulfilled, it should be deleted from the Requests Table; if a donation is fully
used up in satisfying a request, the Donation Table entry should be deleted.
When the user selects ‘4’, the program should print the current Donations Table and the Requests Table.
When the user selects ‘5’, the program should print “Thank You for running the software. Bye for now”, and then the program exits.
Read the rest of this entry »
In: C Programming
10 Feb 2012The Problem:
Every great theme park has a signature roller coaster. In designing a roller coaster, we must decide how many trains of cars need to be placed on the track. It turns out that no more than 25% of the track can be occupied with these trains to adhere to safety regulations. Thus, if the track is 1000 feet long, and a train is 42 feet long, then up to 5 trains can fit on the track. (To see this, note that 5 trains have a total length of 210 feet, and this value is 21%, less than or equal to 25%, of the total track length of 1000 feet. Note that 6 trains would take up 252 feet, or 25.2% of the track, which is too much.)
In a train of cars, the first car is 10 feet long and all subsequent cars are 8 feet long. All cars seat up to 4 people. Since each of these values is constant, please use the following constants to store them:
#define FIRST_CAR_LENGTH 10
#define NORMAL_CAR_LENGTH 8
#define CAR_CAPACITY 4
For this program, the user will enter the total length of the track and the maximum length of the trains for the track. It is assumed that the trains formed will be as long as possible. For example, if the user enters 30 for the maximum length of the train, then the actual trains will have three cars and be of length 26, since a four car train would exceed 30 feet. Your program should calculate the number of people that can be supported on the track at one time. (Note: It may be the case that more people can be supported by making a shorter train than possible, but for this particular assignment, maximize the size of each train.)
Input Specification
1. The total length of the track will be a positive integer (in feet) less than 10000.
2. The maximum length of a train will be a positive integer in between 10 and 100.
I am currently running Pinnacle 1.3 on my Samsung Captivate but while doing a restore using Titanium Backup, something must have gone wrong and my phone started lagging and having issues such as the phone dialer and the messaging app closing on their own so I have decided to re-flash the rom since it’s a great rom and very stable.
I backed up everything with Titanium Backup but I couldn’t find the location of my wallpaper, it took me a while to find it and today I will show where it is and how to save it to a different location. Of course, this is if your current wallpaper is not under your “Gallery” app.