0

A simple Calculator.

import java.util.Scanner;
    public class Calc {

    public static void main(String[] args)throws Exception{
     int op = 0;
     Scanner scan = new Scanner(System.in);
     double num1, num2, ans;
        do{
        do{
            System.out.println("1 for addition. 2 for subtraction. 3 for multiplication. 4 for division");
            op = scan.nextInt();
        }while(op<1 && op>4);

        if(op==1)
        {
         System.out.println("Input your first number: ");
         num1 = scan.nextDouble();
         System.out.println("Input your second number: ");
         num2 = scan.nextDouble();
         ans = num1+num2;
         System.out.println(ans);
         }

        if(op==2)
        {
         System.out.println("Input your first number: ");
         num1 = scan.nextDouble();
         System.out.println("Input your second number: ");
         num2 = scan.nextDouble();
         ans = num1-num2;
         System.out.println(ans);
         }

        if(op==3)
        {
         System.out.println("Input your first number: ");
         num1 = scan.nextDouble();
         System.out.println("Input your second number: ");
         num2 = scan.nextDouble();
         ans = num1*num2;
         System.out.println(ans);
         }

        if(op==4)
        {
         System.out.println("Input your first number: ");
         num1 = scan.nextDouble();
         System.out.println("Input your second number: ");
         num2 = scan.nextDouble();
         ans = num1/num2;
         System.out.println(ans);
         }

         System.out.println("Again? y/n");
         }while(scan.next().equals("y"));
         }

    }
1

This thread is for people to suggest project ideas, not to post actual projects or solutions. If you want to discuss how to implement one of these, or discuss actual code, please start your own new thread.
Thanks
JC

1

This is a fun little program I made to help my brother with his homework.

The Homework Assignment
Find ten words that add up to 100 when a = 1, b = 2, c = 3, etc...

The Java Assignment
Take a text file that is a list of words in the english language (sorry I can't remember where I found it, but look for something that would help with scrabble), and write a program that checks each word and outputs it if it adds up to 100.

0

This is a webpage, aimed to teach beginner programmers to program using either C# or Java, Note it is not a TUTORIAL, those are mathematical exercises and expressions. Dependent on how good is your code's performance you get a score(stars up to 3). I find it very entertaining, hope you do too

2

We set up a program to output correct/incorrect leap year no matter what year entered and set up a program to output the chinese zodiac symbol based on the year you enter. Those were interesting starter Java programs.

0

Heres a good one that I made..
Java IDE that compile the Java program and show the output

Features :

  1. Compile (Only Java Program
  2. Interpret / Run (Java Program)
  3. Decompile (class files)

I've created this project in java and the project is platform independent

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.