The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Skype's beta videophone for Linux looks pretty good iBot UNIX and Linux RSS News 0 12-01-2007 08:05 AM
HELP ASAP.. pretty simple.. ugakid UNIX for Dummies Questions & Answers 8 09-29-2004 04:59 AM
all the pretty scripts gone...gone... michelle UNIX for Dummies Questions & Answers 2 06-21-2001 05:50 AM
pretty good aix doc if you are unfamilar with it Optimus_P AIX 0 06-19-2001 07:30 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-14-2006
Registered User
 

Join Date: Feb 2006
Posts: 1
I am pretty new to this

Ok, so I need to make a program using PICO. Here is the assignment, if anyone knows how to do this please show me. Thanks.

Acme Paints, a well-respected local paint store, is having their big End-Of-Winter Paint Sale. They have way too much red, green, yellow, and blue paint on hand in their showroom and they need to get rid of their old stock in order to make room for the new colors which will be arriving any day.

In order to sell as much of their paint as possible, Acme Paints is advertising some special sale prices. Their paints are available in gallon-size, quart-size, and pint-size containers, and the more you buy, the more you save. Each pint-size container of paint (regardless of the color) costs $5. However, if a customer buys at least a quart of paint (in any combination of quart-size or pint-size containers, and in any combination of colors), he or she would pay only $9 for each quart. Similarly, if a customer buys at least a gallon of paint (in any combination of gallon-size, quart-size, or pint-size containers, and in any combination of colors), he or she would pay only $17 for each gallon.

For example, suppose a customer buys the following colors and containers of paints:

Red: 1 gallon, 2 quarts, and 1 pint
Green: 2 gallons, 1 quarts, and 1 pint
Yellow: 1 gallons, 2 quarts, and 0 pint
Blue: 0 gallons, 1 quart, and 1 pint

At first glance it might seem that the customer has bought a total of 4 gallons, 6 quarts, and 3 pints of paint altogether. However, note that since 2 pints make a quart, a better way to write the total would be as 4 gallons, 7 quarts, and 1 pint. Also, note that since 4 quarts make a gallon, the final total would best be written as 5 gallons, 3 quarts, and 1 pint. Therefore the final cost would be:

5 gallons * $17 per gallon
+ 3 quarts * $ 9 per quart
+ 1 pint * $ 5 per pint

or $117.

Obviously, this is way beyond the ability of the checkout person at Acme Paints, who never did like higher math. So the manager of Acme Paints has hired you, a famous local computer programmer, to write a computer program to help out the store and make the sale a success.

Design, write, and execute a C++ language program that uses the above rules to assist in a paint sale. Your program should first ask the user how many containers of each size and each color of paint are being sold. It should then display a summary of the sale, first listing the number of containers being sold of each size and of each color of paint, and then listing the total number of containers being sold of each size for all colors of paint together. Finally, it should display the total cost of the sale.


The manager of Acme Paints has provided you with a mock-up below of how your program should look when executed.

Good luck!

Acme Paint Pricing Program, version 1.0
(c) (your name), 2006

Enter the number of gallon containers of red paint sold: 1
Enter the number of quart containers of red paint sold: 2
Enter the number of pint containers of red paint sold: 1

Enter the number of gallon containers of green paint sold: 2
Enter the number of quart containers of green paint sold: 1
Enter the number of pint containers of green paint sold: 1

Enter the number of gallon containers of yellow paint sold: 1
Enter the number of quart containers of yellow paint sold: 2
Enter the number of pint containers of yellow paint sold: 0

Enter the number of gallon containers of blue paint sold: 0
Enter the number of quart containers of blue paint sold: 1
Enter the number of pint containers of blue paint sold: 1

Amount of red paint sold: 1 gallon(s), 2 quart(s), and 1 pint(s)
Amount of green paint sold: 2 gallon(s), 1 quart(s), and 1 pint(s)
Amount of yellow paint sold: 1 gallon(s), 2 quart(s), and 0 pint(s)
Amount of blue paint sold: 0 gallon(s), 1 quart(s), and 1 pint(s)

Total amount of paint sold: 5 gallon(s), 3 quart(s), and 1 pint(s)

Total cost: $117

Finishing Acme Paint Pricing Program, version 1.0
Forum Sponsor
  #2  
Old 02-14-2006
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 3,003
Do you also want fries with that?

Please (re)read the rules of these forums and in particular:

(6) Do not post classroom or homework problems.


If you have a specific question you're having problem with, pls repost it.

Thread closed.

Last edited by vgersh99; 02-14-2006 at 05:15 PM.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0