Results 1 to 3 of 3
  1. #1
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Some little applications i made by myself.

    My calculator :)
    Java Code:
    mport java.util.Scanner;
    public class Rekenmachine {
    	public static void main (String args[]){
    		Scanner input = new Scanner (System.in);
    		Scanner input2 = new Scanner (System.in);
    		double fnum;
    		double snum;
    		System.out.println ("Add, Substract, Divide, or Multiply?");
    		String math = input.nextLine();
    		switch (math){
    		case "add":
    		System.out.println ("First number: ");
    		fnum = input.nextInt();
    		System.out.println("Second number: ");
    		snum = input.nextInt();
    		System.out.println(snum + fnum);
    		break;
    		case "substract":
    			System.out.println("First number: ");
    			fnum = input.nextDouble();
    			System.out.println("Second number: ");
    			snum = input.nextDouble();
    			System.out.println(fnum - snum);
    		break;
    		case "divide":
    			System.out.println("First number: ");
    			fnum = input.nextDouble();
    			System.out.println("Second number: ");
    			snum = input.nextDouble();
    			System.out.println(fnum / snum);
    		break;
    		case "multiply":
    			System.out.println("First number: ");
    			fnum = input.nextDouble();
    			System.out.println("Second number: ");
    			snum = input.nextDouble();
    			System.out.println(fnum * snum);
    			
    					
    		 
    		}
    	}
    }
    my little program that generates random numbers and then you have to guess them, if you guess the right number it displays something. and if you guesses it wrong it displays something.
    Java Code:
    import java.util.Scanner;
    import java.util.Random;
    public class RandomNumbers {
    	public static void main(String args[]){
    		Random rand = new Random();
    		Scanner mick = new Scanner (System.in);
    		int rand1 = rand.nextInt(10);
    		int rand2 = rand.nextInt(10);
    		int rand3 = rand.nextInt(10);
    		
    		System.out.println("Guess the first number 1-10: ");
    		if(rand1 == mick.nextInt()){
    			System.out.println("\nCorrect!");
    		}else{
    			System.out.println("\nIncorrect! The right number was: "+rand1);
    		}
    		System.out.println("\n");
    		System.out.println("Guess the second number 1-10: ");
    		if(rand2 == mick.nextInt()){
    			System.out.println("\nCorrect!");
    		}else{
    			System.out.println("\nIncorrect! The right number was: "+rand2);
    		}
    		System.out.println("\n");
    		System.out.println("Guess the third number 1-10: ");
    		if(rand3 == mick.nextInt()){
    			System.out.println("\nCorrect!");
    		}else{
    			System.out.println("\nIncorrect! The right number was: "+rand3);
    		}
    		
    
    		
    	}
    
    }
    my euro to dollar, and dollar to euro converter (i still need to let the course update by itself with connection things etc.)
    Java Code:
    import java.util.Scanner;
    
    class Eurodollar {
    	public static void main(String args []){
    		Scanner input = new Scanner (System.in);
    		System.out.println("press 1 for Euro > Dollar \t press 2 for Dollar > Euro");
    		int amount;
    		String eurodollar = input.nextLine();
    		switch(eurodollar){
    		case "1":
    		System.out.println("You chose for: Euro > Dollar ");	
    		System.out.println("\n");
    		System.out.println("Enter the amount: ");
    	    {
    		amount = input.nextInt();
    		System.out.println("Euro"+"\t"+"Dollar");
    		System.out.println(amount+ "\t" +(amount *  0.767636447));
    		}
    		break;
    		case "2":
    			System.out.println("You chose for: Dollar > Euro ");
    			System.out.println("\n");
    			System.out.println("Enter the amount: ");
    			amount = input.nextInt();
    			System.out.println("Dollar"+"\t"+"Euro");{
    			System.out.println(amount+ "\t" +(amount / 0.767636447));
    			
    			
    		
    			
    	
    		
    		}
    		}
    	}
    }

  2. #2
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: Some little applications i made by myself.

    Nice start! maybe start looking at turning your current applications into GUI versions, having everything run by the console is far from ideal ;)

    Look up Swing, action events, mouse events, Threads etc. and try and turn you calculator into a GUI calculator, it should be fairly simple to do :)


    also switching Strings is case sensitive i think ( at least it is with chars) so if somebody entered "Add" or "ADD" it would technically cause your application to run incorrectly. You should look into error prevention a lot more although these are simple applications you should start to think about "bombing" and error checking.
    Last edited by monkeyjr97; 05-05-2013 at 12:23 AM.

  3. #3
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default Re: Some little applications i made by myself.

    Thanks, and also thanks for the information you gave me! :)

    ill look into it

Similar Threads

  1. How was this made?
    By phyzix5761 in forum New To Java
    Replies: 3
    Last Post: 12-05-2012, 10:02 PM
  2. Replies: 7
    Last Post: 10-14-2012, 06:05 AM
  3. A game made by me.
    By utsav1995 in forum Reviews / Advertising
    Replies: 0
    Last Post: 05-30-2012, 07:41 PM
  4. No class made
    By ChuckLS in forum New To Java
    Replies: 1
    Last Post: 04-28-2009, 04:54 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •