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/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- #include <iostream>
- #include <iomanip>
- using namespace std;
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: calculate_the_job
- // DESCRIPTION: Calculates the price of a job given the number of pages,
- // price per sheet, price per plate, and number of copies.
- // ARGUMENTS: number_of_pages, number_of_copies, price_per_sheet,
- // price_per_plate
- // USES GLOBAL: none
- // MODIFIES GL: none
- // RETURNS: double number
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- double calculate_the_job(int number_of_pages, int number_of_copies, double price_per_sheet, double price_per_plate) {
- return (((number_of_pages * price_per_plate) + (((number_of_pages / 2) * number_of_copies) * price_per_sheet) + (number_of_copies * 2.00)) + (((number_of_pages * price_per_plate) + (((number_of_pages / 2) * number_of_copies) * price_per_sheet) + (number_of_copies * 2.00)) * (17.5 / 100)));
- }
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: calculate_bw_printing
- // DESCRIPTION: Calculates the price of a job given the number of pages and
- // the number of copies for black and white printing.
- // ARGUMENTS: number_of_pages, number_of_copies
- // USES GLOBAL: none
- // MODIFIES GL: none
- // RETURNS: double number
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- double calculate_bw_printing(int number_of_pages, int number_of_copies) {
- return calculate_the_job(number_of_pages, number_of_copies, 0.01, 7);
- }
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: calculate_color_printing
- // DESCRIPTION: Calculates the price of a job given the number of pages and
- // the number of copies for color printing.
- // ARGUMENTS: number_of_pages, number_of_copies
- // USES GLOBAL: none
- // MODIFIES GL: none
- // RETURNS: double number
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- double calculate_color_printing(int number_of_pages, int number_of_copies) {
- return calculate_the_job(number_of_pages, number_of_copies, 0.04, 28);
- }
- ////////////////////////////////////////////////////////////////////////////////
- // NAME: main
- // DESCRIPTION: The main fragment of the program. Outputs information
- // about the functions that are described above.It has
- // been used manipulators to output two numbers after
- // the decimal part of the number.
- // Manipulators Used: setprecision and fixed
- // ARGUMENTS: none
- // USES GLOBAL: none
- // MODIFIES GL: none
- // RETURNS: int(1)
- // AUTHOR/DATE: JP 2017-10-10
- ////////////////////////////////////////////////////////////////////////////////
- int main() {
- cout << fixed << setprecision(2) << calculate_color_printing(32, 1000) << endl;
- cout << calculate_bw_printing(40, 2000) << endl;
- cout << calculate_bw_printing(160, 400) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement