Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commita6e73ce736a7c0e7decb30c9ee63eeca3d14e735 (patch)
Author
 Justsvetoslavov <justsvetoslavov@gmail.com>
2021-10-28 18:11:24 +0300
Committer
 Justsvetoslavov <justsvetoslavov@gmail.com>
2021-10-28 18:11:24 +0300
Files233d014df9df7ac5eccf78961e2d9781a6c2baee
Introduction_to_programming_FMI-a6e73ce736a7c0e7decb30c9ee63eeca3d14e735.tar
Introduction_to_programming_FMI-a6e73ce736a7c0e7decb30c9ee63eeca3d14e735.tar.gz
Introduction_to_programming_FMI-a6e73ce736a7c0e7decb30c9ee63eeca3d14e735.zip
Parent074da16fc9c98cf99a350939b51ec69c9b201801 (diff)
Added Startup_tasks solutions
diff --git a/pract_SI/Pract. 03/Startup_tasks - Solutions/task1_solution1.cpp b/pract_SI/Pract. 03/Startup_tasks - Solutions/task1_solution1.cpp
new file mode 100644
index 0000000..988d53c
--- /dev/null
+++ b/pract_SI/Pract. 03/Startup_tasks - Solutions/task1_solution1.cpp
@@ -0,0 +1,35 @@
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ int n, initialSum;
+ cin >> n;
+ initialSum = n;
+
+ int Hundred_Dollar_Bill = 0;
+ int Fifty_Dollar_Bill = 0;
+ int Twenty_Dollar_Bill = 0;
+ int Ten_Dollar_Bill = 0;
+ int Five_Dollar_Bill = 0;
+ int Two_Dollar_Bill = 0;
+ int One_Dollar_Bill = 0;
+
+ Hundred_Dollar_Bill = n / 100;
+ n %= 100;
+ Fifty_Dollar_Bill = n / 50;
+ n %= 50;
+ Twenty_Dollar_Bill = n / 20;
+ n %= 20;
+ Ten_Dollar_Bill = n / 10;
+ n %= 10;
+ Five_Dollar_Bill = n / 5;
+ n %= 5;
+ Two_Dollar_Bill = n / 2;
+ n %= 2;
+ One_Dollar_Bill = n;
+
+ cout << initialSum << " = " << Hundred_Dollar_Bill << "*100 + " << Fifty_Dollar_Bill << "*50 + " << Twenty_Dollar_Bill << "*20 + " << Ten_Dollar_Bill << "*10 + " <<
+ Five_Dollar_Bill << "*5 + " << Two_Dollar_Bill << "*2 + " << One_Dollar_Bill << "*1" << endl;
+} \ No newline at end of file
diff --git a/pract_SI/Pract. 03/Startup_tasks - Solutions/task1_solution2.cpp b/pract_SI/Pract. 03/Startup_tasks - Solutions/task1_solution2.cpp
new file mode 100644
index 0000000..f01ec74
--- /dev/null
+++ b/pract_SI/Pract. 03/Startup_tasks - Solutions/task1_solution2.cpp
@@ -0,0 +1,35 @@
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ unsigned long long money; //assign money's interval
+ cin >> money; //enter number of money
+
+ cout << "Initial price: " << money << " = "; //Initial price output
+
+ cout << money / 100 << "*100 + "; //output for 100
+ money %= 100; //reduce the 100's
+
+ cout << money / 50 << "*50 + "; //output for 50
+ money %= 50; //reduce the 50's
+
+ cout << money / 20 << "*20 + "; //output for 20
+ money %= 20; //reduce the 20's
+
+ cout << money / 10 << "*10 + "; //output for 10
+ money %= 10; //reduce the 10's
+
+ cout << money / 5 << "*5 + "; //output for 5
+ money %= 5; //reduce the 5's
+
+ cout << money / 2 << "*2 + "; //output for 2
+ money %= 2; //reduce the 2's
+
+ cout << money / 1 << "*1" << endl; //output for 1
+ money %= 1; //reduce the 1's
+
+ cout << "End of program" << endl; //end program
+ return 0; //end program
+} \ No newline at end of file
diff --git a/pract_SI/Pract. 03/Startup_tasks - Solutions/task2.cpp b/pract_SI/Pract. 03/Startup_tasks - Solutions/task2.cpp
new file mode 100644
index 0000000..ab5ca6f
--- /dev/null
+++ b/pract_SI/Pract. 03/Startup_tasks - Solutions/task2.cpp
@@ -0,0 +1,36 @@
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ unsigned long long velocity; //assign velocity's interval
+ cin >> velocity; //enter velocity's value
+
+ if (velocity < 10)
+ cout << "No fine" << endl;
+ else if (velocity == 10)
+ cout << "Fine: 20$" << endl;
+ else if (velocity < 20)
+ cout << "Fine: 50$" << endl;
+ else if (velocity < 30)
+ cout << "Fine: 100$" << endl;
+ else if (velocity < 40)
+ cout << "Fine if in Urban area: 400$" << endl //Urban area fine
+ << "Fine if in Metropolitan area: 300$" << endl; //Metropolitan area fine
+ else if(velocity <= 50)
+ cout << "Fine if in Urban area: 600$" << endl //Urban area fine
+ << "Fine if in Metropolitan area: 400$" << endl;//Metropolitan area fine
+ else
+ {
+ unsigned long long fine = 700 + (((velocity - 50) / 5) * 50);
+
+
+ cout << "Fine if in Urban area: " << fine << "$" << endl
+ << "Additional 3 months driver licence suspension and 12 driver control points." << endl << endl; //Urban area fine
+ cout << "Fine if in Metropolitan area: " << fine - 100 << "$" << endl;//Metropolitan area fine
+ }
+
+ cout << endl << "End of program" << endl; //end program
+ return 0; //end program
+} \ No newline at end of file