From 1dad68ed791db2e9de453d4fa67fe2c161698822 Mon Sep 17 00:00:00 2001 From: Chris's Razer Blade <59944262+CCShambotsProgramming@users.noreply.github.com> Date: Fri, 8 Jan 2021 17:40:12 -0500 Subject: [PATCH] inital commit --- .idea/.gitignore | 3 + .idea/description.html | 1 + .idea/encodings.xml | 6 ++ .idea/inspectionProfiles/Project_Default.xml | 6 ++ .idea/misc.xml | 9 +++ .idea/modules.xml | 8 ++ .idea/project-template.xml | 3 + .idea/vcs.xml | 6 ++ .../untitled/com/company/Main.class | Bin 0 -> 2867 bytes src/com/company/Main.java | 71 ++++++++++++++++++ untitled.iml | 11 +++ 11 files changed, 124 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/description.html create mode 100644 .idea/encodings.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/project-template.xml create mode 100644 .idea/vcs.xml create mode 100644 out/production/untitled/com/company/Main.class create mode 100644 src/com/company/Main.java create mode 100644 untitled.iml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/description.html b/.idea/description.html new file mode 100644 index 0000000..db5f129 --- /dev/null +++ b/.idea/description.html @@ -0,0 +1 @@ +Simple Java application that includes a class with main() method \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..601f39c --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..05cb644 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3007dae --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/project-template.xml b/.idea/project-template.xml new file mode 100644 index 0000000..1f08b88 --- /dev/null +++ b/.idea/project-template.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/out/production/untitled/com/company/Main.class b/out/production/untitled/com/company/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..0d58a0b0e89afe50de301f30bd6b53c1464ab202 GIT binary patch literal 2867 zcmai0TUQfT6#h;~GD92%f&oD&gGD6V;x$(Aj!W-gEZl?EUR?^5psBzX1&3mjoiH zQV`V;LtLQthOuB|Y{Qw!oSnX5<^qBEVau_CqXJc3=_v)OKwY?~7+7{@B4;>`=~W|v zO$sy(o3Z5;D-%n8V9pCfEJq+U7HV2S2|1=}=yQ#Zq4d^6`d`EoQW+68LD z&H1_v!Zrg_#oP3KuB2qijq7f~^o+puRO}Q;_UOHOAE{e+J$;drOai;mr68@L8$GY) zGYp%N&Kmygkeg?utjnm1J^|4q^)ecEV-M?Q-Ygonzh>K|st%?vsn|!2J{1QzbgMYX zVNt~)4s@TwpoYUZLhD98FR*Ka)U8iXdQ<}8n1wB*M$jEDSu(U$yK4d+5WZ!IK=@DDXi zU{auQ-k39oTqkD)7p#DZbNs+?0%oUkgPmbAC8KRh;3HgAa7n{uTv=&`5G11n z#Ej{&I0eJ=O|ol}zk)fI>nbwGDr${H;h7NPlg6~oGAGB} zoMBHHo+bIRFdEES+(dG0E$RnpX+A`ML)YaEDmBHn2;9K1S?^KCQd&~k)6xQaj7UnZ z*DrnB%f5CCoEzQ@qp07&k-+AOz{t&w8-*}r1+tt0+f1tE^E599T8grylH(vb7F2Q^ zB*!dCjsv;Ggj@7-=7=TJQZ0MDU*d;-a?*7JKk$sgxEaj4dA}x(FBA9*Un{sRk?@T` zM+mjBUY4`q&Y77~RZ8F(F>-9nC4pZnVNqUKGJ4u@^0w)BjJfVyu`swkHx-gs6epJo z<_60vleW^G>rD(9wmo45=Aer21k&euP!)JQn|Xb~u#4t^F7*EXe$OPVy?_UsUhv!* z&)~_cjmi^x$Toc6^cCC@*tsqR8|_TNPXcefeko6xQX0_C=8Lf5z|)k_LY(hU$YnSR zj@#0 ze?sF`VZx_*JIds4;sIUDcZz9m=55`EE$BcE(v4fq$0_>ZfeVY`T- zMabK)2D)hEE!T_=(azf|jZV>vE|FzYWihYN$5YzBju|51*~*N1Wf`?rzHSmdj9`|< zPEl&%2Eoxr>vNn{VZVsL=8VY_hcFL^)?Lyb>b!stML|K4?_H}u0o3r(cGU5C!AJzx zP$eP%8qkddWR_024k{Dfy^QlOF)9BFNh~N#gxpFAmnv>D2x)`YVcEu2u9P+0()|b* zj`Z+#w59dheM(B`-oo&~TR6sG6WAMC>n>@8+vG>4U2aphN;NztE5emgZfl0R33{?#~^fgFdhu`RHVb#~CWna9U%f9ZEbJ+Sa zhpl&^wETud@?(NGa=)e3maa?qZRU{y9HZ;wbbSIzoFqDjSk~c+Fj`mB+q#y=ui+lv1;qy=~@C8Hs7T=RgaP|X!#LsB@AG`fjg#Z8m literal 0 HcmV?d00001 diff --git a/src/com/company/Main.java b/src/com/company/Main.java new file mode 100644 index 0000000..729524d --- /dev/null +++ b/src/com/company/Main.java @@ -0,0 +1,71 @@ +package com.company; + +import java.util.Scanner; + +public class Main { + public static void main(String[] args) + { + Scanner in = new Scanner(System.in); + while (true) { + print("Enter first number: "); + String num1 = in.nextLine(); + print("please enter second number"); + String num2 = in.nextLine(); + print("Inputs complete"); + print("Please input operator"); + print("+ , - , * or x , /"); + String op = in.nextLine(); + + switch (op) { + case "+": { + int total = add(num1, num2); + System.out.println(total); + } + case "-": { + int total = sub(num1, num2); + System.out.println(total); + } + case "x": { + int total = mul(num1, num2); + System.out.println(total); + } + case "*": { + int total = mul(num1, num2); + System.out.println(total); + } + case "/": { + int total = div(num1, num2); + System.out.println(total); + } + default: print("Unexpected value: " + op + " ...restarting program"); + } + } + } + private static void print(String text){ + System.out.println(text); + } + private static int add(String num1, String num2){ + int add1 = Integer.parseInt(num1); + int add2 = Integer.parseInt(num2); + return add1 + add2; + } + private static int sub(String num1, String num2){ + int sub1 = Integer.parseInt(num1); + int sub2 = Integer.parseInt(num2); + return sub1 - sub2; + } + private static int mul(String num1, String num2){ + int mul1 = Integer.parseInt(num1); + int mul2 = Integer.parseInt(num2); + return mul1 * mul2; + } + private static int div(String num1, String num2){ + int div1 = Integer.parseInt(num1); + int div2 = Integer.parseInt(num2); + if (div2 == 0 || div1 == 0){ + print("cant divide by zero"); + return -1; + } + return div1 / div2; + } +} \ No newline at end of file diff --git a/untitled.iml b/untitled.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/untitled.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file