The JAVA club

crazycombo

Member
Jul 4, 2008
3,101
13
0
A Land Like No Other!
TDM said:
i agree wit u a bit...reason that the java isnt that much gud wit the computer is that the JAVA eats ur computers recorces......bt C dnt do that dat much.....but remember if you write a clean and simple programs with correct programming teqniques..JAVA is very much gud..coz its a very mobility language..and it is very power full..and also JAVA functioning verry well with almost every kind of systems.....( windows,unix...etc)...

i think if you want to b a gud programmer you hav to learn both...:yes:

java has implemented the garbage collector in first place. then only microsoft people adopted it. there you can enhance the efficiency in java. i think you are talking about JAVA SE with Netbeans or Eclipse. but JAVA EE is really a marvel. that is damn fast and not utilizing that much memory..

btw.. C# is an awesome language + it has the nicest IDE support, which ever the best in any language support groups.

and mind u, no one can survive by knowing only one programming language. its a must to have background knowledge in other pro. langs, networking, exchange server techniques, web technologies such as RSS syndication with GOOD ADMINISTRATION AND MANAGEMENT SKILLS to work in a Bluechip!
 

rochel1977

Well-known member
  • May 15, 2006
    11,466
    2,673
    113
    AKL, NZ and Kandy
    kata hari puluwan nam me java program eka try karala balanda. mata nam mela deyak meke therum ganda be. :no: :no: :no:

    Code:
    A mail-order house sells five products whose retail prices are as follows: 
    
    Product 1, $2.98; 
    product 2, $4.50; 
    product 3, $9.98; 
    product 4, $4.49 and 
    product 5, $6.87. 
    
    Write an application that reads a series a pairs of numbers as follows:
    a)	product number
    b)	quantity sold
    
    Your program should use a switch statement to determine the retail price 
    for each product. It should calculate and display the total retail value 
    of all products sold. Use a sentinel-controlled loop to determine when 
    the program should stop looping and display the final results. 
    You should apply at least one method.
     

    crazycombo

    Member
    Jul 4, 2008
    3,101
    13
    0
    A Land Like No Other!
    rochel1977 said:
    menna magen podi simple program ekak mama liyapu. meka Jcreator wala compile karala balanda. Copy paste karala balanda epa. just type and get the idea.

    Code:
    program that inputs a number and prints whether the number is positive number, negative number or zero. Repeat for 5 numbers.
    
    eg1: Numbers.java
    
    import java.util.Scanner;
    
    public class Numbers
    {
    	public static void main (String [] a) 
    	{
    		Scanner input = new Scanner(System.in);
    			
    		for(int j=0; j<5; j++)
    		{	
    			System.out.println("Enter a number:");
    			double n = input.nextDouble();
    		
    			if(n>0)
    				System.out.println(n +" is a positive number");
    			else if(n<0)
    				System.out.println(n +" is a negative number");
    			else
    				System.out.println(n +" is a zero number");
    		}
    		
    		System.out.println("Type your name:");
    		String name = input.nextLine();
    		
    		System.out.println("Hello "+ name);
    		
    	}
    }

    errors thibunoth methana post karanda. ekathu wela karamu. :yes:

    what if the user enters a character. there must be a validation. and also that can be done by restricting the last else statement to an else if statement to check for 0, and then put else to validate the character input.

    for more java support in Sinhala:
    http://dynamicadahas.wordpress.com/
     

    crazycombo

    Member
    Jul 4, 2008
    3,101
    13
    0
    A Land Like No Other!
    rochel1977 said:
    kata hari puluwan nam me java program eka try karala balanda. mata nam mela deyak meke therum ganda be. :no: :no: :no:

    Code:
    A mail-order house sells five products whose retail prices are as follows: 
    
    Product 1, $2.98; 
    product 2, $4.50; 
    product 3, $9.98; 
    product 4, $4.49 and 
    product 5, $6.87. 
    
    Write an application that reads a series a pairs of numbers as follows:
    a)	product number
    b)	quantity sold
    
    Your program should use a switch statement to determine the retail price 
    for each product. It should calculate and display the total retail value 
    of all products sold. Use a sentinel-controlled loop to determine when 
    the program should stop looping and display the final results. 
    You should apply at least one method.

    Code:
    import java.util.Scanner;
    
    public class products{
    	public static void main(String []args){
    		int choice,ctr,quan;
    		int exitCon=1; 
    		double total=0;
    		double itempr;
    		Scanner input = new Scanner(System.in);
    
    		System.out.println("Product 1 - $2.98");
    		System.out.println("Product 2 - $4.50");
    		System.out.println("Product 3 - $9.98");
    		System.out.println("Product 4 - $4.49");
    		System.out.println("Product 5 - $6.87");
    		
    		
    		while (exitCon==1){
    			System.out.print("Enter The Product ID:");
    			choice = input.nextInt();
    			System.out.print("Enter The Product Quantity:");
    			quan= input.nextInt();
    			switch(choice){
    				case 1: itempr=2.98*quan;break;
    				case 2: itempr=4.50*quan;break;
    				case 3: itempr=9.98*quan;break;
    				case 4: itempr=4.49*quan;break;
    				case 5: itempr=6.87*quan;break;
    				default: System.out.println("Invalid Choice"); itempr=0;break;
    			}
    			total+=itempr;
    			System.out.print("Do you want to purchase another? (1-y/0-n): ");
    			exitCon=input.nextInt();
    			
    		}
    		System.out.println("Grand Total: " + total);
    		
    	}
    }


    Hope this helps!!!!
     

    coolshano

    Well-known member
  • Sep 1, 2007
    14,327
    618
    113
    N/A
    WOW thanks guys for coming and this is a very good start......
    Talk about more cords..... this will help....
     

    rochel1977

    Well-known member
  • May 15, 2006
    11,466
    2,673
    113
    AKL, NZ and Kandy
    crazycombo said:
    Code:
    import java.util.Scanner;
    
    public class products{
    	public static void main(String []args){
    		int choice,ctr,quan;
    		int exitCon=1; 
    		double total=0;
    		double itempr;
    		Scanner input = new Scanner(System.in);
    
    		System.out.println("Product 1 - $2.98");
    		System.out.println("Product 2 - $4.50");
    		System.out.println("Product 3 - $9.98");
    		System.out.println("Product 4 - $4.49");
    		System.out.println("Product 5 - $6.87");
    		
    		
    		while (exitCon==1){
    			System.out.print("Enter The Product ID:");
    			choice = input.nextInt();
    			System.out.print("Enter The Product Quantity:");
    			quan= input.nextInt();
    			switch(choice){
    				case 1: itempr=2.98*quan;break;
    				case 2: itempr=4.50*quan;break;
    				case 3: itempr=9.98*quan;break;
    				case 4: itempr=4.49*quan;break;
    				case 5: itempr=6.87*quan;break;
    				default: System.out.println("Invalid Choice"); itempr=0;break;
    			}
    			total+=itempr;
    			System.out.print("Do you want to purchase another? (1-y/0-n): ");
    			exitCon=input.nextInt();
    			
    		}
    		System.out.println("Grand Total: " + total);
    		
    	}
    }


    Hope this helps!!!!

    wow. ela macho. :)
     

    ¤--bACarDi--¤

    Well-known member
  • Jan 9, 2009
    12,130
    288
    83
    124.43.xxx.xxx
    TDM said:
    i agree wit u a bit...reason that the java isnt that much gud wit the computer is that the JAVA eats ur computers recorces......bt C dnt do that dat much.....but remember if you write a clean and simple programs with correct programming teqniques..JAVA is very much gud..coz its a very mobility language..and it is very power full..and also JAVA functioning verry well with almost every kind of systems.....( windows,unix...etc)...

    i think if you want to b a gud programmer you hav to learn both...:yes:

    :yes: :yes:
    U knw JAVA is Damn Slow cuz of JVM...jst see Every Software on Windows or even Linux/Unix(Open office) are slow...somtimes it stucks computer...Bad with multitasking with other programmes.....:confused:

    Java is gud for other divices(ATM machines , Missile Control systems , Aircrafts)...All that things surrounded by JAVA.....

    Other thing is Web....Now Java rulz the web...Bt ASP.NET is the newest thing for Web applications....

    And we r all on C.... cuz windows kernel , Linux kernel Even DOS Programmed using C & C++.....:yes: And JAVA also Programmed by using C:lol: ;)
     

    amilabanuka

    Well-known member
  • Sep 30, 2006
    7,291
    878
    113
    Thama math hoyanooo....
    crazycombo said:
    Code:
    import java.util.Scanner;
    
    public class products{
        public static void main(String []args){
            int choice,ctr,quan;
            int exitCon=1; 
            double total=0;
            double itempr;
            Scanner input = new Scanner(System.in);
    
            System.out.println("Product 1 - $2.98");
            System.out.println("Product 2 - $4.50");
            System.out.println("Product 3 - $9.98");
            System.out.println("Product 4 - $4.49");
            System.out.println("Product 5 - $6.87");
            
            
            while (exitCon==1){
                System.out.print("Enter The Product ID:");
                choice = input.nextInt();
                System.out.print("Enter The Product Quantity:");
                quan= input.nextInt();
                switch(choice){
                    case 1: itempr=2.98*quan;break;
                    case 2: itempr=4.50*quan;break;
                    case 3: itempr=9.98*quan;break;
                    case 4: itempr=4.49*quan;break;
                    case 5: itempr=6.87*quan;break;
                    default: System.out.println("Invalid Choice"); itempr=0;break;
                }
                total+=itempr;
                System.out.print("Do you want to purchase another? (1-y/0-n): ");
                exitCon=input.nextInt();
                
            }
            System.out.println("Grand Total: " + total);
            
        }
    }

    Hope this helps!!!!

    that's cool solution
    But when reading it I feel they are expecting us to read that string from a file or kind a thing.
     

    amilabanuka

    Well-known member
  • Sep 30, 2006
    7,291
    878
    113
    Thama math hoyanooo....
    crazycombo said:
    Code:
    import java.util.Scanner;
    
    public class products{
        public static void main(String []args){
            int choice,ctr,quan;
            int exitCon=1; 
            double total=0;
            double itempr;
            Scanner input = new Scanner(System.in);
    
            System.out.println("Product 1 - $2.98");
            System.out.println("Product 2 - $4.50");
            System.out.println("Product 3 - $9.98");
            System.out.println("Product 4 - $4.49");
            System.out.println("Product 5 - $6.87");
            
            
            while (exitCon==1){
                System.out.print("Enter The Product ID:");
                choice = input.nextInt();
                System.out.print("Enter The Product Quantity:");
                quan= input.nextInt();
                switch(choice){
                    case 1: itempr=2.98*quan;break;
                    case 2: itempr=4.50*quan;break;
                    case 3: itempr=9.98*quan;break;
                    case 4: itempr=4.49*quan;break;
                    case 5: itempr=6.87*quan;break;
                    default: System.out.println("Invalid Choice"); itempr=0;break;
                }
                total+=itempr;
                System.out.print("Do you want to purchase another? (1-y/0-n): ");
                exitCon=input.nextInt();
                
            }
            System.out.println("Grand Total: " + total);
            
        }
    }

    Hope this helps!!!!

    that's cool solution
    But when reading it I feel they are expecting us to read that string from a file or kind a thing.