From 92f76a93f3a4c7e94624488221bba220badf305c Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Thu, 26 Oct 2023 11:32:43 +0200 Subject: [PATCH] Created the solution_3.cpp --- units/2023_10_26/solution_3.cpp | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 units/2023_10_26/solution_3.cpp diff --git a/units/2023_10_26/solution_3.cpp b/units/2023_10_26/solution_3.cpp new file mode 100644 index 0000000..f20735f --- /dev/null +++ b/units/2023_10_26/solution_3.cpp @@ -0,0 +1,35 @@ +#include + +using namespace std; + +int main() { + // Variablendeklaration + int Maeuse, Einzelpreis; + double Nettowarenwert, Transportpauschale, Umsatzsteuer, Bruttobetrag; + + // Eingabe + cout << "Geben Sie die Anzahl der PC-Maeuse ein: "; + cin >> Maeuse; + + cout << "Geben Sie den Einzelpreis ein: "; + cin >> Einzelpreis; + + // Berechnung + Nettowarenwert = Maeuse * Einzelpreis; + Transportpauschale = Maeuse >= 10 ? 0 : 10; + Umsatzsteuer = (Nettowarenwert + Transportpauschale) * 0.19; + Bruttobetrag = Nettowarenwert + Transportpauschale + Umsatzsteuer; + + + // Ausgabe + cout.setf(ios::fixed); + cout.precision(2); + + cout << endl; + + cout << "Nettowarenwert : " << Nettowarenwert << " Euro" << endl; + cout << "+ Transportpauschale : " << Transportpauschale << " Euro" << endl; + cout << "+ Umsatzsteuer : " << Umsatzsteuer << " Euro" << endl; + cout << "------------------------------------" << endl; + cout << "= Bruttobetrag : " << Bruttobetrag << " Euro" << endl; +} \ No newline at end of file