I need help for a program

closed account (4i8bko23)
Hello I’m wondering how to make his program.Can you help me?Also
I’m new at programming.The program must be in c++.


A printer has the following pricing system for books. For black and white printing, each sheet of paper costs a penny. In addition, they have to make a plate for each page of the original, costing 7 pounds. For colour printing, each sheet of paper costs 4 pennies, and the plates are 28 pounds. Binding costs 2 pound per copy of the book. These prices exclude 17.5% VAT (VAT has not yet risen on this bookbinder's planet). The printing is double sided.
As an example, printing 400 black and white books with 100 pages each costs:
100*7 pounds
£
700.00
for the plates.
(100/2)*400*1 pennies
£
200.00
for the paper. (2 pages per sheet)
400*2 pounds
£
800.00
for the binding.
Subtotal
£
1700.00

VAT
£
297.50
17.5% over 1700 pounds
Grand Total
£
1997.50

1. Write a function that calculates the price of a job given the number of pages, price per sheet, price per plate, and number of copies.
2. Write a function that calculates the price of a job given the number of pages and the number of copies for black and white printing. This function should call the function that you wrote for part 1.
3. Write a function that calculates the price of a job given the number of pages and the number of copies for colour printing. This function should call the function that you wrote for part 1.
4. Write a main program that calculates the total price of printing 1000 colour books with 32 pages, 2000 black/white books with 40 pages and 400 black/white books with 160 pages. The main function should call the functions that you wrote for parts 2 and 3.
Last edited on
1. The function you need to write is double priceForJob(int numPages, double pricePerSheet, double pricePerPlate, int numCopies); All costs are in pounds.

2. This just calls priceForJob() with the appropriate values for black&white printing:
double priceForBW(int numPages, int numCopies) {
return priceForJob(numPages, 0.01, 7, numCopies);
}

3. This calls priceForJob() with the appropriate values for color printing:
1
2
3
double priceForColor(int numPages, int numCopies) {
    return priceForJob(numPages, 0.04, 28, numCopies);
}


4. Your main program makes one call to priceForBW and one call to priceForColor and prints the results of each call.


closed account (4i8bko23)
Тhank you.This was very helpful.And now i need a little clues for this:
I have begin making it but i get so much errors.

1. Change the function that calculates the price of a job so that it assumes that books are printed with 16-fold signatures. (ie, the number of sheets is rounded up to the nearest multiple of 16).
Change the main function so that it prints in addition to the previous number:
• The price of printing 50 colour books of 30 pages each with 16-fold signatures.
• The price of printing 35 black and white books of 34 pages each with 16-fold signatures.


Please note: You don't need to change the parameters of your functions for this part. Each printed page (including partially printed pages) will need a plate, but blank pages won't. You may print out the first answer using a 16 fold signature as well for this part. Three numbers should therefore be printed for this extension.

You may wish to find out how to obtain remainders in C using the modulus operator %, for example a % b in C will give the integer remainder when a is divided by b. You may also want to look at 'typecasting' - forcing conversion from one type into another type - because it is a common technique used for rounding in C. For example, typecasting a non-whole number as an integer will round it down to the nearest integer, e.g. (int) 3.14159 will evaluate to exactly 3.

2. Change the functions so that the number of pages in a signature is passed as a parameter. (ie, the number of sheets is rounded up to the nearest multiple of n, where n is the size of the signature)
Change the main function so that it prints in addition to the previous three numbers:
• The price of printing 35 black and white books of 34 pages each with 8 fold signatures.
• The price of printing 100 black and white books of 34 pages each with 6 fold signatures.

Please note: For this extension you must print 5 numbers (the original [under a 16 fold signature], two for the first extension, two for this second extension).

I have begin making it but i get so much errors.

Please post the code that you have.
Topic archived. No new replies allowed.