Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: main.cpp
- // DESCRIPTION: A program that helps a printer in making quotes for their
- // products.
- // AUTHOR: Stf Kolew
- // AUTHOR/DATE: 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- #include <iostream>
- #include <iomanip>
- using namespace std;
- double const BLACK_WHITE_PRINTING = 0.01;
- double const COLOURFUL_PRINTING = 0.04;
- double const VAT = 17.5;
- int const COLOURFUL_PLATE = 28;
- int const BINDING = 2;
- int const BLACK_WHITE_PLATE = 7;
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: calculatePriceOfTheJob
- // DESCRIPTION: Calculates the price of a job given the number of pages, price
- // per sheet, price per plate, and number of copies.
- // ARGUMENTS: pages, copies, price_per_sheet(opt.), price_per_plate(opt.)
- // USES GLOBAL: BINDING
- // MODIFIES GL: none
- // RETURNS: double
- // AUTHOR: Stf Kolew
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- double calculatePriceOfTheJob(int pages, int copies, double price_per_sheet = 0, int price_per_plate = 0) {
- double total_price = (pages * price_per_plate) + (((pages / 2) * copies) * price_per_sheet) + (copies * BINDING);
- return total_price + (total_price * (VAT / 100));
- }
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: calculatePriceOfTheJob2
- // DESCRIPTION: Calculates the price of a job given the number of pages and
- // the number of copies for black and white printing using
- // calculatePriceOfTheJob1 function
- // ARGUMENTS: pages, copies
- // USES GLOBAL: BLACK_WHITE_PLATE, BLACK_WHITE_PRINTING, BINDING
- // MODIFIES GL: none
- // RETURNS: double
- // AUTHOR: Stf Kolew
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- double calculatePriceOfBlackWhitePrinting(int pages, int copies) {
- return calculatePriceOfTheJob(pages, copies, BLACK_WHITE_PRINTING, BLACK_WHITE_PLATE);
- }
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: calculatePriceOfTheJob3
- // DESCRIPTION: Calculates the price of a job given the number of pages and
- // the number of copies for black and colour printing using
- // calculatePriceOfTheJob1 function
- // ARGUMENTS: pages, copies
- // USES GLOBAL: COLOURFUL_PLATE, COLOURFUL_PRINTING, BINDING
- // MODIFIES GL: none
- // RETURNS: double
- // AUTHOR: Stf Kolew
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- double calculatePriceOfColourfulPrinting(int pages, int copies) {
- return calculatePriceOfTheJob(pages, copies, COLOURFUL_PRINTING, COLOURFUL_PLATE);
- }
- int main() {
- cout << "1000 colour books with 32 pages: " << fixed << setprecision(2) << calculatePriceOfColourfulPrinting(32, 1000) << endl;
- cout << "1000 black/white books with 40 pages: " << calculatePriceOfBlackWhitePrinting(40, 2000) << endl;
- cout << "400 black/white books with 160 pages: " << calculatePriceOfBlackWhitePrinting(160, 400) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement