Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

Let us say a Company uses codes to represent its various products a codes includes, among other information, a character in tenth position that represents the zone from which that product was made, and 4 digits integer in position 4 thru 7 that represents the district in which it will be sold. Due to some reorganization, products from zone R are banned from being sold in districts with a designation of 2000 or higher. Writ a complete program to count and print number of banned and valid code entered. Example: TRV2475A5R-14 valid TRL2k74A5R-11 : distr JAVA

OpenStudy (anonymous):

this problem meets your requirements and please notify if some enhancement can be done

OpenStudy (anonymous):

import java.util.Scanner; class code { public static void main(String arg[]) { char arr[]=new char[4]; Scanner sc=new Scanner(System.in); System.out.print("Enter the code of product"); String str=sc.nextLine(); if(str.length()<13 || str.length()>13) { System.out.println("the code is invalid"); code.main(arg); } else { // char ch=str.charAt(4); //System.out.print(ch); //System.out.print(str); try { for(int i=0;i<4;i++) { arr[i]=(str.charAt(i+3)); } } catch(Exception ex) { System.out.print("The numeric values not found"); } int x=0; int add=1000; int xr[]=new int[4]; try { for(int i=0;i<4;i++) { Character ch=arr[i]; String strs=ch.toString(); int ssx=Integer.parseInt(strs); xr[i]=ssx; x=x+(ssx*add); add=add/10; } if(str.charAt(9)=='R'&& x>=2000 && check(xr)==false) { System.out.print("The above code product has been banned in this district or it is not from zone R"); } else System.out.print("this product code is valid "); } catch(Exception ex) { System.out.print("Invalid code"); } } } static boolean check(int ara[]) { int count=0; for(int i=0;i<4;i++) { if(Character.isDigit(ara[i])) { count++; } else { } } if(count==0) return false; else stro: return true; } }

OpenStudy (anonymous):

I gurantee u have Dell Laptop and Dell Webcam

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!