summaryrefslogtreecommitdiffstats
path: root/C++/Test1/BookStoreReceipt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'C++/Test1/BookStoreReceipt.cpp')
-rw-r--r--C++/Test1/BookStoreReceipt.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/C++/Test1/BookStoreReceipt.cpp b/C++/Test1/BookStoreReceipt.cpp
new file mode 100644
index 0000000..ef6d903
--- /dev/null
+++ b/C++/Test1/BookStoreReceipt.cpp
@@ -0,0 +1,58 @@
+// Name: msglm
+// Date: Feb-14-2022
+// Program Name: Bookstore Receipt Program
+// Description: a program that will calculate the price (plus tax) of a book store recieipt
+
+
+#include <iostream>
+#include <string>
+#include <iomanip>
+using namespace std;
+
+// Named constants
+double const TAX = 0.0964;
+double const BOOKPRICE = 5.00;
+double const COPYPRICE = 1.10;
+double const PENPRICE = 1.15;
+double const FOLDERPRICE = 1.00;
+
+int main() {
+
+ //Variable declaration
+ int book, copy, pen, folder;
+ double total;
+
+ //Program title and description for the user
+ cout << "Title: Bookstore Receipt Program" << endl << "Description: a program that will calculate the price (plus tax) of a book store recieipt" << endl;
+
+ // User input
+ cout << "How many books would you like?\n";
+ cin >> book;
+ cout << "How many packs of copy paper would you like?\n";
+ cin >> copy;
+ cout << "How many packs of pens would you like?\n";
+ cin >> pen;
+ cout << "How many folder packs would you like?\n";
+ cin >> folder;
+ // Calculations for the total price (Without Tax)
+ total = (book*BOOKPRICE + copy*COPYPRICE + pen*PENPRICE + folder*FOLDERPRICE);
+ // Output to the screen
+ cout << "Receipt: \n";
+ cout << "Books: $" << book*BOOKPRICE << endl;
+ cout << "Packs of Copy Paper: $" << copy*COPYPRICE << endl;
+ cout << "Packs of Pens: $" << pen*PENPRICE << endl;
+ cout << "Packs of Folders: $" << folder*FOLDERPRICE << endl;
+ cout << "Total (Without Tax): $" << total << endl;
+ cout << "Total Tax: $" << total*TAX << endl;
+ cout << "Total (With Tax): $" << total+(total*TAX) << endl;
+
+
+ return 0;
+}
+
+/*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+