├── dhanu.png ├── SimpleCalculator.java └── README.md /dhanu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vinaykumarmahato/Simple-Calculator-Using-java/HEAD/dhanu.png -------------------------------------------------------------------------------- /SimpleCalculator.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class SimpleCalculator { 4 | public static void main(String[] args) { 5 | Scanner scanner = new Scanner(System.in); 6 | 7 | System.out.println("Welcome to the Simple Calculator!"); 8 | 9 | System.out.print("Enter the first number: "); 10 | double num1 = scanner.nextDouble(); 11 | 12 | System.out.print("Enter the second number: "); 13 | double num2 = scanner.nextDouble(); 14 | 15 | System.out.println("Select the operation:"); 16 | System.out.println("1. Addition (+)"); 17 | System.out.println("2. Subtraction (-)"); 18 | System.out.println("3. Multiplication (*)"); 19 | System.out.println("4. Division (/)"); 20 | 21 | System.out.print("Enter your choice (1-4): "); 22 | int choice = scanner.nextInt(); 23 | 24 | double result = 0.0; 25 | String operation = ""; 26 | 27 | switch (choice) { 28 | case 1: 29 | result = num1 + num2; 30 | operation = "+"; 31 | break; 32 | case 2: 33 | result = num1 - num2; 34 | operation = "-"; 35 | break; 36 | case 3: 37 | result = num1 * num2; 38 | operation = "*"; 39 | break; 40 | case 4: 41 | if (num2 != 0) { 42 | result = num1 / num2; 43 | operation = "/"; 44 | } else { 45 | System.out.println("Error: Division by zero is not allowed."); 46 | return; 47 | } 48 | break; 49 | default: 50 | System.out.println("Error: Invalid choice."); 51 | return; 52 | } 53 | 54 | System.out.println("Result: " + num1 + " " + operation + " " + num2 + " = " + result); 55 | 56 | scanner.close(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simple Calculator Using Java 2 | 3 | This is a simple calculator program written in Java that can perform basic arithmetic operations such as addition, subtraction, multiplication, and division. 4 | 5 | ## Usage 6 | 7 | To use the calculator, simply run the `Calculator.java` file in your preferred IDE or from the command line. The program will prompt you to enter two numbers and an operator (+, -, *, /) to perform the desired operation. 8 | 9 | 10 | The program will continue to prompt you for input until you enter "exit" as the operator. 11 | 12 | 13 | ## Repository Structure 14 | 15 | The repository is organized as follows: 16 | 17 | - src/ 18 | - Calculator.java 19 | 20 | ### Contributing 21 | Contributions are welcome! If you find any bugs or have suggestions for improvement, please open an issue or submit a pull request. 22 | 23 | 24 | 25 | ⚡Subscribe on LinkedIn🌱🌱🌱 26 | ⚡Subscribe on YouTube🌱🌱🌱 27 | 28 | ⚡Follow me on Instagram🌱🌱🌱 29 | 30 | 31 | ![Alt Text](dhanu.png) 32 | 33 | 34 | 35 | 36 | # 💫 About Me: 37 | 🔭 I’m currently working on content creation and freelancing also I'm doing internship by pw Skills in the field of java development
👯 I’m looking to collaborate on Back-End development as well as content creation
🤝 I’m looking for help with developing many software that can find the user easily
🌱 I’m currently learning java DSA system Design by pw skills ( Physics wallah )
💬 Ask me about - java, HTML, CSS, JAVASCRIPT | DBMS | MongoDB | JDBC | DSA | System Design | Spring Boot | Spring Rest | PHOTOGRAPHY & EDITER |
⚡ Fun fact - coding lover , singing , teaching 38 | 39 | 40 | ## 🌐 Socials: 41 | [![Facebook](https://img.shields.io/badge/Facebook-%231877F2.svg?logo=Facebook&logoColor=white)](https://facebook.com/https://facebook.com/groups/602312964862870/) [![Instagram](https://img.shields.io/badge/Instagram-%23E4405F.svg?logo=Instagram&logoColor=white)](https://instagram.com/https://www.instagram.com/invites/contact/?i=td1e6t78x4bp&utm_content=oeyjr77) [![LinkedIn](https://img.shields.io/badge/LinkedIn-%230077B5.svg?logo=linkedin&logoColor=white)](https://linkedin.com/in/https://www.linkedin.com/in/vinay-kumar860964) [![Twitter](https://img.shields.io/badge/Twitter-%231DA1F2.svg?logo=Twitter&logoColor=white)](https://twitter.com/https://twitter.com/ADV_India_coder) [![YouTube](https://img.shields.io/badge/YouTube-%23FF0000.svg?logo=YouTube&logoColor=white)](https://youtube.com/@https://youtube.com/@advindiancoder) 42 | 43 | # 💻 Tech Stack: 44 | ![C](https://img.shields.io/badge/c-%2300599C.svg?style=plastic&logo=c&logoColor=white) ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=plastic&logo=css3&logoColor=white) ![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=plastic&logo=java&logoColor=white) ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=plastic&logo=javascript&logoColor=%23F7DF1E) ![Python](https://img.shields.io/badge/python-3670A0?style=plastic&logo=python&logoColor=ffdd54) ![Azure](https://img.shields.io/badge/azure-%230072C6.svg?style=plastic&logo=azure-devops&logoColor=white) ![Anaconda](https://img.shields.io/badge/Anaconda-%2344A833.svg?style=plastic&logo=anaconda&logoColor=white) ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=plastic&logo=node.js&logoColor=white) ![ANDROID](https://img.shields.io/badge/android-%2320232a.svg?style=plastic&logo=android&logoColor=%a4c639) ![IOS](https://img.shields.io/badge/IOS-%2320232a.svg?style=plastic&logo=apple&logoColor=white) ![React](https://img.shields.io/badge/react-%2320232a.svg?style=plastic&logo=react&logoColor=%2361DAFB) ![Apache](https://img.shields.io/badge/apache-%23D42029.svg?style=plastic&logo=apache&logoColor=white) ![MySQL](https://img.shields.io/badge/mysql-%2300f.svg?style=plastic&logo=mysql&logoColor=white) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=plastic&logo=mongodb&logoColor=white) ![Adobe After Effects](https://img.shields.io/badge/Adobe%20After%20Effects-9999FF.svg?style=plastic&logo=Adobe%20After%20Effects&logoColor=white) ![Adobe Audition](https://img.shields.io/badge/Adobe%20Audition-9999FF.svg?style=plastic&logo=Adobe%20Audition&logoColor=white) ![Adobe InDesign](https://img.shields.io/badge/Adobe%20InDesign-49021F?style=plastic&logo=adobeindesign&logoColor=white) ![Canva](https://img.shields.io/badge/Canva-%2300C4CC.svg?style=plastic&logo=Canva&logoColor=white) ![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?style=plastic&logo=numpy&logoColor=white) ![Pandas](https://img.shields.io/badge/pandas-%23150458.svg?style=plastic&logo=pandas&logoColor=white) ![LINUX](https://img.shields.io/badge/Linux-FCC624?style=plastic&logo=linux&logoColor=black) 45 | # 📊 GitHub Stats: 46 | ![](https://github-readme-stats.vercel.app/api?username=ADVindiancoder&theme=radical&hide_border=false&include_all_commits=false&count_private=false)
47 | ![](https://github-readme-streak-stats.herokuapp.com/?user=ADVindiancoder&theme=radical&hide_border=false)
48 | ![](https://github-readme-stats.vercel.app/api/top-langs/?username=ADVindiancoder&theme=radical&hide_border=false&include_all_commits=false&count_private=false&layout=compact) 49 | 50 | ## 🏆 GitHub Trophies 51 | ![](https://github-profile-trophy.vercel.app/?username=ADVindiancoder&theme=onedark&no-frame=false&no-bg=true&margin-w=4) 52 | 53 | ## 🐦 Latest Tweet 54 | [![](https://gtce.itsvg.in/api?username=https://twitter.com/ADV_India_coder)](https://github.com/VishwaGauravIn/github-twitter-card-embed) 55 | 56 | ### ✍️ Random Vinay kumar java developer Quotes 57 | ![](https://quotes-github-readme.vercel.app/api?type=horizontal&theme=radical) 58 | 59 | ### 🔝 Top Contributed Repo 60 | ![](https://github-contributor-stats.vercel.app/api?username=ADVindiancoder&limit=5&theme=dark&combine_all_yearly_contributions=true) 61 | 62 | ### 😂 Random vinay kumar java developer Meme 63 | 64 | 65 | --- 66 | [![](https://visitcount.itsvg.in/api?id=ADVindiancoder&icon=0&color=0)](https://visitcount.itsvg.in) 67 | 68 | 69 | --------------------------------------------------------------------------------