Please help me transform this C++ code to java code....

guys...please help me transform this C++ code to java code....please try to explain the code..thanks
[program]
#include <stdio.h>
#define ALIVE 1
#define DEAD 0
#define SZ 33
int stschk (int ,int );
main()
int s[SZ][SZ], i, j;
for (i=0; i<sz; i++ ) s[0] = DEAD;
for (j=0; j<sz; j++ ) s[0][j] = DEAD;
s[0][1] = ALIVE;
for (i=0; i<sz-1; i++) {
for ( j=1;j<sz;j++ ) {
s[i][j] = stschk(s[i][j-1],s[i+1][j];
if(s[i][j-1]==ALIVE) printf("*");
else printf(" ");
printf("\n");
int stschk(int s1,int s2)
if(((s1==DEAD)&&(s2==ALIVE))||
((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
else return DEAD;

Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
    int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant.

Similar Messages

  • Please help me in this tough problem in Java...im just new in Java program

    my teacher give this as a problem. so tough. we are just starting and we are now in control structures. please help me to finish this problem. And my problem is...
    Write an astrology program. The user types in his or her birthday(month,day,year),
    and the program responds with the user's zodiac sign, the traits associated with each sign
    the user's age(in years,months,day), the animal sign for the year(e.g., Year of the Pig,
    Year of the Tiger), the traits associated with each animal sign, and if the year is a leap
    year or not. The dates covered for each sign can be searched through the horoscope section
    of a newspaper or through the internet. Then enhance your program so that if the user is one
    or two days away from the adjacent sign, the program outputs the nearest adjacent sign as well
    as the traits associated with the nearest sign. The month may be entered as a number from 1 to 12
    or in words, i.e.,January to December. Limit the year of the birthday from 1900 to 2010 only.
    The program should allow the user to repeat the entire process as often as desired.
    You can use:
    import java.text.DateFormat;
    import java.util.Date;
    import java.util.Calendar;
    please...those who are genius out there in java program...help us to pass this project. Im begging! thanks!

    Frowner_Stud wrote:
    According to the second commandment: Thou shall not use the name of the Lord in vain.Is this not the definition of ironic, Mr. Morality?
    i am not cheating. And more of the same.
    we all know that an assignment is an assignment. a homework. homework means you can raise other help from somebody so that you will know the answer.You're not asking for "help" bucko, because you've been given decent help but have chosen to ignore it. No, you're asking for someone to do the work for you, and you may call it what you want, but in anyone else's book, that's cheating.
    dont be fool enough to reply if you dont know the reason why i am typing here Don't be fool enough to think that you can control who can or can't respond.
    because if you are in my part and if i know the answer there is no doubt that i will help you as soon as possible! Just because you have low morals doesn't mean that the rest of us do.
    Thanks for time of reading and God bless you including you family!and to you and yours. Have a blessed day.

  • I brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem

    i brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem

    Hi Daniel ...
    Try here > iTunes Store: Invalid, inactive, or illegible codes

  • I have upgraded My leopard to Mountain lion 10.7 via snow leapeard. Now My itunes is not working properly nor I able to install google chrome successfully. Please help me in this occasion. I am facing following messages.

    Hello Team,
    I have upgraded My leopard to Mountain lion 10.7 via snow leapeard. Now My itunes is not working properly nor I able to install google chrome successfully. Please help me in this occasion.
    Also, I am not being able to upgrade Mac OS X 10.7 to 10.7.4 or letest for lion.
    I am facing following messages when I open itunes ( I down loaded and install new for 10.7)
    Process:         iTunes [463]
    Path:            /Applications/iTunes.app/Contents/MacOS/iTunes
    Identifier:      com.apple.iTunes
    Version:         10.7 (10.7)
    Build Info:      iTunes-10702101~1
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [273]
    Date/Time:       2012-10-22 23:33:07.226 +0200
    OS Version:      Mac OS X 10.7 (11A390)
    Report Version:  8
    Interval Since Last Report:          4918 sec
    Crashes Since Last Report:           2
    Per-App Crashes Since Last Report:   2
    Anonymous UUID:                      3DE933E2-7A48-4840-91F4-7DC466ED9C26
    Crashed Thread:  0
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Application Specific Information:
    dyld: launch, loading dependent libraries
    @executable_path/../Frameworks/iPodUpdater.framework/Versions/A/iPodUpdater
    Dyld Error Message:
      Library not loaded: @executable_path/../Frameworks/iPodUpdater.framework/Versions/A/iPodUpdater
      Referenced from: /Applications/iTunes.app/Contents/MacOS/iTunes
      Reason: unsafe use of @executable_path in /Applications/iTunes.app/Contents/MacOS/iTunes with restricted binary
    Binary Images:
           0x102a96000 -        0x103c36fff  com.apple.iTunes (10.7 - 10.7) <0CC47E12-134F-A9E1-7E4F-3EAC797C3050> /Applications/iTunes.app/Contents/MacOS/iTunes
        0x7fff62696000 -     0x7fff626cb1ff  dyld (195 - ???) <71093406-21CF-3DBE-A001-802259ED5300> /usr/lib/dyld
    Model: MacBook4,1, BootROM MB41.00C1.B00, 2 processors, Intel Core 2 Duo, 2.4 GHz, 2 GB, SMC 1.31f1
    Graphics: Intel GMA X3100, GMA X3100, Built-In, 144 MB
    Memory Module: BANK 0/DIMM0, 1 GB, DDR2 SDRAM, 667 MHz, 0xAD00000000000000, 0x48594D503131325336344350362D59352020
    Memory Module: BANK 1/DIMM1, 1 GB, DDR2 SDRAM, 667 MHz, 0xAD00000000000000, 0x48594D503131325336344350362D59352020
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x88), Broadcom BCM43xx 1.0 (5.10.131.36.5)
    Bluetooth: Version 2.5.0b13, 2 service, 12 devices, 2 incoming serial ports
    Network Service: AirPort, AirPort, en1
    Serial ATA Device: FUJITSU MHY2160BH, 160.04 GB
    Parallel ATA Device: MATSHITADVD-R   UJ-867
    USB Device: Built-in iSight, apple_vendor_id, 0x8501, 0xfd400000 / 2
    USB Device: USB Receiver, 0x046d  (Logitech Inc.), 0xc52f, 0x1d100000 / 2
    USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8205, 0x1a100000 / 2
    USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x022a, 0x5d200000 / 3
    USB Device: IR Receiver, apple_vendor_id, 0x8242, 0x5d100000 / 2
    And Google chrome just keep loading the page for hours and nothing is appear on its browser. But safari and firefox working absolutly fine.
    In addition, I have reboot computer as well but it never worked. Please help me in this occasion.
    Eagerly waiting for your response on this issue.
    Best Regards,

    You need to upgrade your copy of MS Office. You're using a version that is 8 years old (at least). You can buy Office 2011, which will work. You could also get a copy of Pages from the App Store, which is cheaper and will open Word files (though not perfectly). Or you could get a free Office clone, like OpenOffice or LibreOffice.

  • SoundFonts - small problem. Please help me because this is very important to

    Hello everyone. I have just upgraded from a SoundBlaster Audigy, to a SoundBlaster X-Fi Music edition.
    I have a collection of soundfonts which I used to use on my Audigy. They worked fine. Now that I'm using the X-Fi, they all work well, apart from one, and the one that doesn't work is my most used, most important soundfont.
    Description of problem:
    When I run my midi file, it starts playing the music using the new soundfont, but after about 0 seconds or so, the sound stops - even though the music is still playing. I then can occasionally hear a note or two, but its no longer playing properly. All my other soundfonts work perfectly, so I really dont understand why this one would cause troubles. They are all .SF2 files.
    Other Information:
    ) I am using "SoundFont Bank Manager" to load the soundfonts. They all work great apart from the main one I want to use. It worked fine on my Audigy. The Cache part says 7.3mb Used/ 229.8mb Free.
    2) I am on Windows XP Professional - Service pack 2.
    3) The rest of my computer is very powerful. Its a core2duo, 2gig of RAM, 320gig seagate barracuda hard dri've etc. Regularly defragged.
    4) I have the latest soundcard drivers (And direct X, video drivers, bios drivers, etc.).
    5) I have no other problems with the computer.
    6) My Midi program is Guitar Pro, which plays special midi files. It is set up properly, and it plays everything perfectly - using all my soundfonts, except the one I most want to use..
    Please help me get this working. It is very important to me, and I need to get it working as soon as possible. I'll keep searching this thread incase I need to give any more information.
    Thanks in advance.Message Edited by acrobat on 02-09-200705:0 AM

    Why do you have two threads dealing with the exact same issue. That makes it confusing and hard to follow your issue to help you.
    Who is your carrier, I asked in the other thread?
    Have you tried YOUR sim card in another device, what happens?
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Hi Everyone...Please help me with this query...!

    Please Help me with this doubt as I am unable to understand the logic...behind this code. It's a begineer level code but I need to understand the logic so that I am able to grasp knowledge. Thank you all for being supportive. Please help me.
    //Assume class Demo is inherited from class SuperDemo...in other words class Demo extends SuperDemo
    //Volume is a method declared in SuperDemo which returns an integer value
    //weight is an integer vairable declared in the subclass which is Demo
    class Example
         public static void main(String qw[])
              Demo ob1=new Demo(3,5,7,9);
    //Calling Constructor of Demo which takes in 4 int parameters
              SuperDemo ob2=new SuperDemo();
              int vol;
              vol=ob1.volume();
              System.out.println("Volume of ob1 is " + vol);
              System.out.println("Weight of ob1 is " + ob1.weight);
              System.out.println();
              ob2=ob1;
    }Can someone please make me understand --- how is this possible and why !
    If the above statement is valid then why not this one "System.out.println(ob2.weight);"
    Thanks Thanks Thanks!

    u see the line wherein I am referencing the objectof
    a subclass to the superclass...right? then why we
    can't do System.out.println(ob2.weight)?You need to distinguish two things:
    - the type of the object, which determines with the
    object can do
    - the type of the reference to the object, which
    determines what you see that you can do
    Both don't necessarily have to match. When you use a
    SuperDemo reference (obj2) to access a Demo instance
    (obj1), for all you know, the instance behind obj2 is
    of type SuperDemo. That it's in reality of type Demo
    is unknown to you. And usually, you don't care -
    that's what polymorphism is about.
    So you have a reference obj2 of type SuperDemo.
    SuperDemo objects don't have weight, so you don't see
    it - even though it is there.So from ur explanation wat I understand is - Even though u reference a subclass object to a superclass, u will only be able to access the members which are declared in the superclass thru the same...right
    ?

  • CrashReporter - Could you please help to understand this crash report?

    Could you please help to understand this crash report below?
    If I'm not wrong it started after update the Mac OS X to version 10.5.6 - every startup.
    Note: First update by regular update then after by combo.
    Thanks in advance!
    _ CrashReporter
    Process: aslmanager [218]
    Path: /usr/sbin/aslmanager
    Identifier: aslmanager
    Version: ??? (???)
    Code Type: X86 (Native)
    Parent Process: launchd [1]
    Date/Time: 2009-04-05 08:29:52.069 -0300
    OS Version: Mac OS X 10.5.6 (9G55)
    Report Version: 6
    Exception Type: EXCBADACCESS (SIGSEGV)
    Exception Codes: KERNINVALIDADDRESS at 0x0000000000200000
    Crashed Thread: 0
    Thread 0 Crashed:
    0 libSystem.B.dylib 0x952a8a85 asl_get64 + 11
    1 libSystem.B.dylib 0x952aa034 aslfile_fetchpos + 939
    2 libSystem.B.dylib 0x952aa2f6 aslfilematch + 339
    3 aslmanager 0x00002409 0x1000 + 5129
    4 aslmanager 0x00002b3e 0x1000 + 6974
    5 aslmanager 0x0000211a 0x1000 + 4378
    Thread 0 crashed with X86 Thread State (32-bit):
    eax: 0x001ffffc ebx: 0x952a9ca1 ecx: 0x00000000 edx: 0x00000000
    edi: 0x0000ff3d esi: 0x00100b30 ebp: 0xbffffbc8 esp: 0xbffffba0
    ss: 0x0000001f efl: 0x00010286 eip: 0x952a8a85 cs: 0x00000017
    ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037
    cr2: 0x00200000
    Binary Images:
    0x1000 - 0x2ffd +aslmanager ??? (???) <201b2dea48b8d80ac1432ff85244ed31> /usr/sbin/aslmanager
    0x8fe00000 - 0x8fe2db43 dyld 97.1 (???) <100d362e03410f181a34e04e94189ae5> /usr/lib/dyld
    0x9444a000 - 0x9444efff libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib
    0x951a4000 - 0x951abfe9 libgcc_s.1.dylib ??? (???) <f53c808e87d1184c0f9df63aef53ce0b> /usr/lib/libgcc_s.1.dylib
    0x951ba000 - 0x95321ff3 libSystem.B.dylib ??? (???) <d68880dfb1f8becdbdac6928db1510fb> /usr/lib/libSystem.B.dylib
    0xffff0000 - 0xffff1780 libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib
    _ Log
    05/04/09 8:25:58 com.apple.loginwindow[35] Shutdown NOW!
    05/04/09 8:25:58 com.apple.loginwindow[35] System shutdown time has arrived
    05/04/09 8:25:58 com.apple.SystemStarter[30] Stopping Missing Sync Listener
    05/04/09 8:25:58 com.apple.SystemStarter[30] Stopping HP Trap Monitor
    05/04/09 8:25:58 com.apple.SystemStarter[30] Stopping HP IO Monitor
    05/04/09 8:25:59 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/Pvsnet.kext succeeded
    05/04/09 8:25:59 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/ConnectUSB.kext succeeded
    05/04/09 8:26:02 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/vmmain.kext succeeded
    05/04/09 8:26:02 com.apple.SystemStarter[30] kextunload: unload kext /System/Library/Extensions/hypervisor.kext succeeded
    05/04/09 8:26:35 com.apple.launchctl.System[2] BootCacheControl: could not open /var/db/BootCache.playlist: No such file or directory
    05/04/09 8:26:35 com.apple.launchctl.System[2] BootCacheControl: could not unlink playlist /var/db/BootCache.playlist: Unknown error: -1
    05/04/09 8:26:37 com.apple.launchctl.System[2] launchctl: Please convert the following to launchd: /etc/mach_init.d/dashboardadvisoryd.plist
    05/04/09 8:26:37 com.apple.launchd[1] (com.apple.blued) Unknown key for boolean: EnableTransactions
    05/04/09 8:26:37 com.apple.launchd[1] (org.cups.cupsd) Unknown key: SHAuthorizationRight
    05/04/09 8:26:37 com.apple.launchd[1] (org.ntp.ntpd) Unknown key: SHAuthorizationRight
    05/04/09 8:26:49 org.ntp.ntpd[27] Error : nodename nor servname provided, or not known
    05/04/09 8:26:57 com.apple.SystemStarter[30] Starting up Missing Sync Listener
    05/04/09 8:26:57 com.apple.SystemStarter[30] Starting HP IO Monitor
    05/04/09 8:26:58 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/hypervisor.kext is already loaded
    05/04/09 8:26:58 com.apple.SystemStarter[30] Starting HP Trap Monitor
    05/04/09 8:26:58 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/vmmain.kext is already loaded
    05/04/09 8:26:59 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/ConnectUSB.kext is already loaded
    05/04/09 8:27:00 com.apple.SystemStarter[30] kextload: extension /System/Library/Extensions/Pvsnet.kext is already loaded
    05/04/09 8:27:00 com.apple.SystemStarter[30] kextload: /Library/StartupItems/Parallels/Pvsvnic.kext loaded successfully
    05/04/09 8:27:06 com.apple.SystemStarter[30] Sun Apr 5 08:27:06 wslys-Mac.local Missing Sync Listener[77] <Warning>: 3891612: (CGSLookupServerRootPort) Untrusted apps are not allowed to connect to or launch Window Server before login.
    05/04/09 8:27:06 com.apple.SystemStarter[30] Sun Apr 5 08:27:06 wslys-Mac.local Missing Sync Listener[77] <Error>: kCGErrorRangeCheck : On-demand launch of the Window Server is allowed for root user only.
    05/04/09 8:27:06 com.apple.SystemStarter[30] Sun Apr 5 08:27:06 wslys-Mac.local Missing Sync Listener[77] <Error>: kCGErrorRangeCheck : Set a breakpoint at CGErrorBreakpoint() to catch errors as they are returned
    05/04/09 8:27:08 com.apple.SystemStarter[30] _RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
    05/04/09 8:27:20 com.apple.launchd[1] (com.apple.UserEventAgent-LoginWindow[123]) Exited: Terminated
    05/04/09 8:27:20 com.apple.launchctl.Aqua[129] launchctl: Please convert the following to launchd: /etc/machinit_peruser.d/RemoteUI.plist
    05/04/09 8:27:20 com.apple.launchd[116] (com.apple.AirPortBaseStationAgent) Unknown key for boolean: EnableTransactions
    05/04/09 8:27:21 com.apple.FolderActions.enabled[130] launchctl: Error unloading: com.apple.FolderActions.folders
    05/04/09 8:27:42 quicklookd[146] [QL ERROR] 'Creating thumbnail' timed out for '<QLThumbnailRequest /Users/wsly/Downloads/m090374535329zdwg_650ref.mov>'
    05/04/09 8:27:42 Dock[138] [QL ERROR] quicklookd crashed while thumbnailing /Users/wsly/Downloads/m090374535329zdwg_hdref.mov
    05/04/09 8:29:52 com.apple.launchd[1] (com.apple.aslmanager[218]) Exited abnormally: Segmentation fault

    Try repairing the disk through the Mac OS X install disk.

  • How to transform this pascal code into java code!

    I want to transform this pascal code into java code . Please tel me how to do it because I really don't know how to do it!
    Thanks!
    {CALCULATE HOHN-LONDON FACTORS}
    var kk:tab4;
    PROCEDURE INTENS(var kk:tab4);
    begin
    for n:=0 to nr+2 do
    begin
    kk^[1,n]:=sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1)) +lup*(yg-2);
    kk^[2,n]:= sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1))-lup*(yg-2);
    kk^[3,n]:=0.5*(kk^[1,n]*kk^[1,n]+4*(sqr(n+1)-lup*lup));
    kk^[4,n]:= 0.5*(kk^[2,n]*kk^[2,n]+4*(sqr(n+1)-lup*lup));
    kk^[5,n]:= sqrt(ldown*ldown*yd*(yd-4)+4*sqr(n+1)) +ldown*(yd-2);
    end;
    end;
    BEGIN
    new (kk);
    intens(kk);
    writeln(f2,' ','N ','V','branch ','H-L');
    for n:=1 to np do
    begin
    fp1[n,v]:=(n-ldown)*(n+ldown+1)*sqr(kk^[2,n-1]*kk^[6,n]+4*(n+ldown)*(n-ldown+1));
    fp1[n,v]:=fp1[n,v]/(4*(n+0.5)*kk^[4,n-1]*kk^[8,n]) ;
    writeln(f2,' ',n,' ',v,' fp1 ',fp1[n,v]:10:2);
    end;
    for n:=1 to nq do
    begin
    fq1[n,v]:=sqr(kk^[2,n]*kk^[6,n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)) ;
    fq1[n,v]:=fq1[n,v]/(2*(n+0.5)*kk^[4,n]*kk^[8,n]*(n+1.5));
    fq1[n,v]:=fq1[n,v]*(n+1);
    writeln(f2,' ',n,' ',v,' fq1 ',fq1[n,v]:10:2);
    end;
    for n:=1 to nr do
    begin
    fr1[n,v]:=sqr(kk^[2,n+1]*kk^[6,n]+4*(n-ldown+2)*(n+ldown+1));
    fr1[n,v]:=fr1[n,v]/(4*kk^[4,n+1]*kk^[8,n]*(n+1.5));
    fr1[n,v]:=fr1[n,v]*(n-ldown+1)*(n+ldown+2) ;
    writeln(f2,' ',n,' ',v,' fr1 ',fr1[n,v]:10:2);
    end;

    Basically it looks like this:
    public class KK{
         private your_type[][] kk = new your_type[length][length];
         private void intens(your_type[] kk){
              for(int n= 0; n<nr+2; n++){
                   kk[1][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2)) +lup*(yg-2);
                   kk[2][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2))-lup*(yg-2);
                   kk[3][n] = 0.5*(kk[1][n]*kk[1][n]+4*(Math.pow((n+1), 2)-lup*lup));
                   kk[4][n] = 0.5*(kk[2][n]*kk[2][n]+4*(Math.pow((n+1), 2)-lup*lup));
                   kk[5][n] = Math.sqrt(ldown*ldown*yd*(yd-4)+4*Math.pow((n+1), 2)) +ldown*(yd-2);
         public static void main(String args[]){
              KK k = new KK();
              k.intens(kk);
              System.out.println(f2  + ' ' + 'N ' + 'V' + 'branch ' + 'H-L');
              for(int n=1; n < np; n++){
                   fp1[n][v] = (n-ldown)*(n+ldown+1)*Math.pow((kk[2][n-1]*kk[6][n]+4*(n+ldown)*(n-ldown+1)), 2);
                   fp1[n][v] = fp1[n][v]/(4*(n+0.5)*kk[4][n-1]*kk[8][n]) ;
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fp1 ' + fp1[n][v]:10:2);
              for(int n=1; n< nq;n++){
                   fq1[n][v] = Math.pow((kk[2][n]*kk[6][n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)), 2);
                   fq1[n][v] = fq1[n][v]/(2*(n+0.5)*kk[4][n]*kk[8][n]*(n+1.5));
                   fq1[n][v] = fq1[n][v]*(n+1);
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fq1 ' + fq1[n][v]:10:2);
              for(int n=1; n < nr; n++){
                   fr1[n][v] = Math.pow((kk[2][n+1]*kk[6][n]+4*(n-ldown+2)*(n+ldown+1)), 2);
                   fr1[n][v] = fr1[n][v]/(4*kk[4][n+1]*kk[8][n]*(n+1.5));
                   fr1[n][v] = fr1[n][v]*(n-ldown+1)*(n+ldown+2) ;
                   System.out.println(f2 + ' ' + n + ' ' + v + ' fr1 ' + fr1[n][v]:10:2); //fr1[n][v]:10:2 --> Here you must use the BigDecimal class
    }I'm not very sure because my pascal knowledge is extremely "dated".
    What about the converter I told you about?

  • Please help me with this statement

    Hi gurus, glad to be back!
    Please help me with this XML processing statement. The XMl I get is like this,
    <EnumerationValue description="Motor Carriers-Operate w/o Certificate or Permit"
    effectiveDate="1859-01-01">
              <Text>26</Text>
              <AssociatedValue type="SeverityLevelText" code="MSD">
                   <Text>Misdemeanor</Text>
              </AssociatedValue>
              <AssociatedValue type="SeverityLevelText" code="PMD">
                   <Text>Petty Misdemeanor</Text>
              </AssociatedValue>
              <AssociatedValue type="StatuteOrdinanceRuleCite">
                   <Text>221.291.4</Text>
              </AssociatedValue>
    I need to get the number value from <Text>26</Text>, the attribute description and the text value of <Text>221.291.4</Text> inside one of those AssociatedValue node. The following is what I have, though I get the 26, I do not get the description and I get the Misdemeanor, Petty Misdemeanor concatenated with the text value of <Text>221.291.4</Text>. The output I get is this,
    26
    MisdemeanorPetty Misdemeanor221.291.4MisdemeanorPe
    4
    MisdemeanorPetty Misdemeanor221.291.4MisdemeanorPe
    My Code:
    declare
         v_xml sys.xmltype;
         v_sid     number;
         v_SText     varchar2(50);
    begin
         v_xml := sys.xmltype('<SimpleTypeCompanion>
              <EnumerationValue description="Motor Carriers-Operate w/o Certificate or Permit" effectiveDate="1859-01-01">
              <Text>26</Text>
              <AssociatedValue type="SeverityLevelText" code="MSD">
                   <Text>Misdemeanor</Text>
              </AssociatedValue>
              <AssociatedValue type="SeverityLevelText" code="PMD">
                   <Text>Petty Misdemeanor</Text>
              </AssociatedValue>
              <AssociatedValue type="StatuteOrdinanceRuleCite">
                   <Text>221.291.4</Text>
              </AssociatedValue>
         </EnumerationValue>
         <EnumerationValue description="Police Communication Equipment-Possession, Use-First Offense-M" effectiveDate="1859-01-01">
         <Text>4</Text>
         <AssociatedValue type="SeverityLevelText" code="MSD">
              <Text>Misdemeanor</Text>
         </AssociatedValue>
         <AssociatedValue type="SeverityLevelText" code="PMD">
              <Text>Petty Misdemeanor</Text>
         </AssociatedValue>
         <AssociatedValue type="StatuteOrdinanceRuleCite">
              <Text>299C.37.1(b)</Text>
         </AssociatedValue>
         </EnumerationValue>
         </SimpleTypeCompanion>');
         ---dbms_output.put_line(v_xml.getStringVal());
         declare
              cursor c_statutes is
              select ms.* from
              xmltable('for $s in /SimpleTypeCompanion/EnumerationValue/Text
                   let $sa := /SimpleTypeCompanion/EnumerationValue/AssociatedValue
                   let $sd := /SimpleTypeCompanion/EnumerationValue/@description
                   where $sa/@type = "StatuteOrdinanceRuleCite"
                   return
                        <MyStatutes>
                             <TextID>{$s}</TextID>
                             <SDesc>{$sd/@description}</SDesc>
                             <StatuteNumber>{$sa/Text}</StatuteNumber>
                        </MyStatutes>'
                   passing v_xml
                   columns
                   myTextID     number path '/MyStatutes/TextID',
                   mySDesc          varchar2(150) path '/MyStatutes/SDesc',     
                   myStatute     varchar2(50)     path '/MyStatutes/StatuteNumber'
              ) ms;
         begin
              for v_s in c_statutes loop
                   dbms_output.put_line(v_s.myTextID);
                   dbms_output.put_line(v_s.MySDesc);
                   dbms_output.put_line(v_s.myStatute);
              end loop;
         end;
    end;
    Please show me the correct way to get the result I want.
    Thanks a lot!
    Ben

    SQL>  var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :xmltext :=
      3  '<SimpleTypeCompanion>
      4     <EnumerationValue description="Motor Carriers-Operate w/o Certificate or Permit" effectiveDate="1859-01-01">
      5             <Text>26</Text>
      6             <AssociatedValue type="SeverityLevelText" code="MSD">
      7                     <Text>Misdemeanor</Text>
      8             </AssociatedValue>
      9             <AssociatedValue type="SeverityLevelText" code="PMD">
    10                     <Text>Petty Misdemeanor</Text>
    11             </AssociatedValue>
    12             <AssociatedValue type="StatuteOrdinanceRuleCite">
    13                     <Text>221.291.4</Text>
    14             </AssociatedValue>
    15     </EnumerationValue>
    16     <EnumerationValue description="Police Communication Equipment-Possession, Use-First Offense-M" effectiveDate="1859-01-01">
    17             <Text>4</Text>
    18             <AssociatedValue type="SeverityLevelText" code="MSD">
    19                     <Text>Misdemeanor</Text>
    20             </AssociatedValue>
    21             <AssociatedValue type="SeverityLevelText" code="PMD">
    22                     <Text>Petty Misdemeanor</Text>
    23             </AssociatedValue>
    24             <AssociatedValue type="StatuteOrdinanceRuleCite">
    25                     <Text>299C.37.1(b)</Text>
    26             </AssociatedValue>
    27     </EnumerationValue>
    28  </SimpleTypeCompanion>';
    29  end;
    30  /
    PL/SQL procedure successfully completed.
    SQL> set lines 150
    SQL> --
    SQL> select ms.*
      2    from xmltable
      3         (
      4           '/SimpleTypeCompanion/EnumerationValue'
      5           passing xmltype(:xmltext)
      6           columns
      7           DESCRIPTION            varchar2(32) path '@description',
      8           STATUTE_ID             number(2) path 'Text/text()',
      9           STATUTE_RULE_CITE      varchar2(16) path 'AssociatedValue[@type="StatuteOrdinanceRuleCite"]/Text/text()',
    10           MSD_TEXT               varchar2(10) path 'AssociatedValue[@code="MSD"]/Text/text()',
    11           PMD_TEXT               varchar2(10) path 'AssociatedValue[@code="PMD"]/Text/text()'
    12        ) ms
    13  /
    DESCRIPTION                      STATUTE_ID STATUTE_RULE_CIT MSD_TEXT   PMD_TEXT
    Motor Carriers-Operate w/o Certi         26 221.291.4        Misdemeano Petty Misd
    Police Communication Equipment-P          4 299C.37.1(b)     Misdemeano Petty Misd
    SQL>
    SQL>

  • Could you please help me make this query less complicated

    could you please help me make this query less complicated
    select t1.R_OBJECT_ID
    from dm_relation_sp a, ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID
    union all
    select t3.R_OBJECT_ID
    from ddt_resolution_sp t3
    where t3.R_OBJECT_ID in (select t2.child_id
    from dm_relation_sp t2
    where t2.parent_id in (select a.child_id
    from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID))
    union all
    select t4.R_OBJECT_ID
    from ddt_resolution_sp t4
    where t4.R_OBJECT_ID in(
    select t3.child_id from dm_relation_sp t3
    where t3.parent_id in (
    select t2.child_id
    from asud_fsk.dm_relation_sp t2
    where t2.parent_id in (select a.child_id
    from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID))
    and t3.relation_name = 'RESOLUTION_RELATION')
    union all
    select t5.R_OBJECT_ID
    from ddt_resolution_sp t5
    where t5.R_OBJECT_ID in
    (select t4.child_id
    from dm_relation_sp t4
    where t4.parent_id in(
    select t3.child_id from dm_relation_sp t3
    where t3.parent_id in (
    select t2.child_id
    from asud_fsk.dm_relation_sp t2
    where t2.parent_id in (select a.child_id
    from asud_fsk.dm_relation_sp a, asud_fsk.ddt_resolution_sp t1
    where a.parent_id = '0900000283560456' -----------ID
    and a.child_id = t1.R_OBJECT_ID))
    and t3.relation_name = 'RESOLUTION_RELATION')
    and t4.relation_name = 'RESOLUTION_RELATION')
    Edited by: user13025450 on 29.04.2010 16:23

    Hi,
    Welcome to the forum! You'll find that there are many qualified people (such as Tubby) willing to help you. Will you do what you can to help them? In order to simplify the query you posted,someone will first have to understand what it does, what the tables that it uses are like, and what tools you have to work with (that is, what version of Oracle, and any other software you are using). To actually test their ideas, people will need versions of your tables.
    Many people, if they spent enough time, might be able to figure out roughly what you are doing, make some tables themselves and test a solution. You can help with all of that. I assume you already know what the appliction is, and what this particular query is supposed to do: you don't have to figure out any of that, you just have to say it. You know what all your tables are, what the datatypes of all the columns are, and what kinds of data are in the tables: you don't have to guess at any of that.
    Describe what you're doing. Think about it: how do we know that
    SELECT  NULL
    FROM    dual;doesn't do what you want?
    Post CREATE TABLE and INSERT statements for a little sample data.
    Post the results that this query is supposed to produce from those results. (Is it producing the right output now? Then it should be easy to post the correct results.)
    Describe, as well as you can, how the present query is doing it.
    Format your existing code, so it's easy to see what the different branches of the UNION are, and what the main clauses are in each one.
    When posting formatted text (code or results) type these 6 characters
    \(all small letters, inside curly brackets) before and after each formatted section, to keep this site from compressing the spaces.
    Say what versions of Oracle (e.g. 10.2.0.3.0) and any other relevant software you are using.
    I know it's a lot of work, but it really helps. You can do it as well (probably better) than anyone else, and if you're unwilling to do it, why should anyone else be willing?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • I am not able to launch FF everytime i tr to open it, it says FF has to submit a crash report, i even tried doing that and the report was submitted too, but stiil FF did not start, and the problem still persists, please help me solve this issue in English

    Question
    I am not able to launch FF everytime i try to open it, it says FF has to submit a crash report,and restore yr tabs. I even tried doing that and the report was submitted too, but still FF did not start, and the problem still persists, please help me solve this issue
    '''(in English)'''

    Hi Danny,
    Per my understanding that you can't get the expect result by using the expression "=Count(Fields!TICKET_STATUS.Value=4) " to count the the TICKET_STATUS which value is 4, the result will returns the count of all the TICKET_STATUS values(206)
    but not 180, right?
    I have tested on my local environment and can reproduce the issue, the issue caused by you are using the count() function in the incorrect way, please modify the expression as below and have a test:
    =COUNT(IIF(Fields!TICKET_STATUS.Value=4 ,1,Nothing))
    or
    =SUM(IIF(Fields!TICKET_STATUS=4,1,0))
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Hello, i restored and updated my iphone 4 to the latest version of 5.1.1 and after that when i connect my mobile to i tunes all i see is a big rectangle and a apple logo on left and a small lock on right side please help me fix this problem.

    hello,
    i restored and updated my iphone 4 to the latest version of 5.1.1 and after that when i connect my mobile to i tunes all i see is a big rectangle and a apple logo on left and a small lock on right side please help me fix this problem.

    I sloved this issue by resting my phone from settings>general>reset>reset all settings...the problem will be fixed

  • I bought a movie the movie Godzilla 2014 recently but it didn't show up in my library. I went check the itunes store and it wants me to buy it again. Please help me with this problem.

    I just bought this movie "Godzilla 2014" but it won't show in my Movie Library. I closed my Itunes and put it back on again but still won't show up. I checked my purchased list and it shows that I recently bought the movie but when I checked the itunes store it wants to buy the movie again. Please help me with this right away Apple.

    Apple Store Customer Service at 1-800-676-2775 or visit online Help for more information.
    To contact product and tech support: Contacting Apple for support and service - this includes
    international calling numbers..
    For Mac App Store: Apple - Support - Mac App Store.
    For iTunes: Apple - Support - iTunes.

  • My icloud activation lock is ON my iphone, which requires an activation login to access the homescreen, but when i log in with the apple ID on the phone, it says the apple ID is not meant to unclock this iphone 5 ios 8.0.2. please help me solve this.

    My icloud activation lock is on my iphone, which requires an activation login to access the homescreen, but when i log in with the apple ID on the phone, it says the apple ID is not meant to unclock this iphone 5 ios 8.0.2. please help me solve this.

    Yes the phone belongs to me. It was purchased from United Kingdom Vodafone to West Africa, i had to factory unlock to use any sim in it. so it belongs to me. I did the activation myself, now after updating my iphone to the latest update, it required a user id and password to activate the phone, but anytime i enter the details, it tells me the user Id is not correct but the password is correct..

  • HT5278 My words with friends kept disappearing on screen 3 seconds after opening. So I deleted & reinstalled it today 8/17/12 & it still happens. I'm so frustrated I dont know what to do next. Please help me w/this

    My iPad 1 doesn't stay logged on. It stays @ 3 seconds.this has been happening for a week s I deleted that app, &amp; downloaded another, same one &amp; STILL won't stay opened on page. Please help me figure this out. Very much appreciated. Thank you, Connie Sypriano

    There's a whole lot to read in your post, and frankly I have not read it all.
    Having said that, this troubleshooting guide should help:
    http://support.apple.com/kb/TS1538
    In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it.

Maybe you are looking for

  • How to create the relationship between ESSBASE 11 and DM  in OBIEE 11G?

    Hi Experts, I have one requirement that there is one property table named 'Store Master' in DW,and it contains a lot of attribute, such as Open Date, Close Date, IS 24 Hour etc. But another data source is essbase and based on this source, I create al

  • What are the 3-bit field choices for Hw_Arm_Sel in PCI-6601

    Hi, I am programming our own driver to operate the PCI-6601. For our application we need hardware arm option. I know it is possible to use 2 counters for that, but NI-TIO should support also hw_arm. Although it is not explained in the registry docume

  • Creating objects with proper stereotypes

    Hi, I'm just trying to create Architecture Areas and Business Functions using VB. This all works as expected, besides of one small but important exception: I want to create Architecture Areas and Business Functions of a given type (Stereotype). When

  • Attachments not showing

    Hi, I have been customising the HW sample application. I have an issue with attachments. When I select an item to add an attachement and/or a url, it doesn't seem to appear when I forward the workitem to the next user when they pick up the same item.

  • Maverick. Mirroring Screen to TV Airplay Icon Not visible in Menu bar

    Hi, I recently upgraded my OS to Maverick 10.9.1 from Snow leopard. My Laptop is a Macbook 13" Aluminium Late 2008. How do I get the Airplay Icon to appear in the Menu Bar so that I can Mirror whats on my macbook to my Television. This is the only re