Help with output

Hi,
i have two tables
create table mac(ID number, Name varchar2(100))
insert into mac values(1,'Doughnut machine');
insert into mac values(2 , 'Hamburger machine');
insert into mac values(3, 'Ice cream machine');
create table Parts(ID number, Name varchar2(100),fk_mac number)
insert into parts values(1,'Screws',2);
insert into parts values(2, 'Nails', 3);
insert into parts values(3, 'Rivets', 1);
insert into parts values(4, 'Glue', 2);
insert into parts values(5, 'Plates', 2);
insert into parts values(6, 'Panels', 3);
Now i query this table with the following query
select x.id, x.name,y.prt1,y.prt2,y.prt3,y.prt4,y.prt5,y.prt6 from(
select fk_mac,decode(id,1,name,' ')prt1,
decode(id,2,name,' ')prt2,
decode(id,3,name,' ')prt3,
decode(id,4,name,' ')prt4,
decode(id,5,name,' ')prt5,
decode(id,6,name,' ')prt6
from parts)y,mac x
where x.id=y.fk_mac
i get the output as follows
ID NAME     PRT1 PRT2 PRT3 PRT4 PRT5 PRT6
1 Doughnut machine          Rivets               
2 Hamburger machine Screws                         
2 Hamburger machine          Glue          
2 Hamburger machine               Plates     
3 Ice cream machine     Nails                    
3 Ice cream machine                    Panels
I need output as
ID NAME     PRT1 PRT2 PRT3 PRT4 PRT5 PRT6
1 Doughnut machine          Rivets               
2 Hamburger machine Screws          Glue Plates           
3 Ice cream machine     Nails          Panels          
Could someone help me with this...
thanks in advance

i am sorry but the output i am getting with that
subquery is
FK_MAC     PRT1     PRT2     PRT3     PRT4     PRT5     PRT6
1               Rivets               
2                              
3                              
which is not correct i need to get
ID NAME PRT1 PRT2 PRT3 PRT4 PRT5 PRT6
1 Doughnut machine Rivets
2 Hamburger machine Screws Glue Plates
3 Ice cream machine Nails Panels
thanks..Sorry.
My error
select x.id, x.name,
min(decode(y.id,1,y.name)), min(decode(y.id,2,y.name)),
min(decode(y.id,3,y.name)), min(decode(y.id,4,y.name)),
min(decode(y.id,5,y.name)), min(decode(y.id,6,y.name))
from scott.parts y,scott.mac x
where x.id=y.fk_mac
group by x.id, x.nameRegards
Dmytro

Similar Messages

  • Subquery results need help with output

    Requirements:
    There is request to dump every day’s data from one table into text file.
    Tables:INSPECTION_RESULTS
    NJAS
    Primary Key: RES_SYS_NO
    Parent table: INSPECTION_RESULTS
    Child table: NJAS
    Purpose:
    1. obtain output results for the MIN and MAX RES_SYS_NO from INSPECTION_RESULTS table for yesterday’s date.
    2. Create comma delimited file for following columns using above table data output.
    Script thus far:
    SELECT NJA_RES_SYS_NO||','||NJA_TEST_REC_NO||','||NJA_LIC_ST_ID||','||NJA_ETS_ID||','||NJA_SW_VER||','||NJA_TECH_ID||','||NJA_VIN||','||NJA_LIC_NO||','
    ||NJA_LIC_JUR||','||NJA_LIC_SRC||','||NJA_MODEL_YR||','||NJA_MAKE||','||NJA_MODEL||','||NJA_VHCL_TYPE||','||NJA_BODY_STYLE||','||NJA_CERT_CLASS||','||
    NJA_GVWR||','||NJA_ASM_ETW||','||NJA_ETW_SRC||','||NJA_NO_OF_CYL||','||NJA_ENG_SIZE||','||NJA_TRANS_TYPE||','||NJA_DUAL_EXH||','||NJA_FUEL_CD||','
    || NJA_VID_SYS_NO||','|| NJA_VRT_REC_NO||','|| NJA_ARMSTDS_REC_NO||','|| NJA_RSN_F_N_TESTABLE||','|| NJA_DYNO_TESTABLE||','||
    NJA_CURR_ODO_RDNG||','|| NJA_PREV_ODO_RDNG||','|| NJA_PREV_TEST_DT||','|| NJA_TEST_TYPE||','||
    NJA_TEST_START_DT||','|| NJA_TEST_END_TIME||','|| NJA_EMISS_TEST_TYPE||','|| NJA_TEST_SEQ_NO||','
    ||NJA_LOW_MILE_EXEMP||','||NJA_TIRE_DRY||','|| NJA_REL_HUMID||','|| NJA_AMB_TEMP||','||NJA_BAR_PRESS||','|| NJA_HCF||','||
    NJA_GAS_CAP_ADAP_AVL||','|| NJA_GAS_CAP_REPL||','|| NJA_OVERALL_GAS_CAP_RES
    FROM NJAS
    WHERE NJA_RES_SYS_NO IN (SELECT MIN(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS WHERE NJA_RES_SYS_NO IN
    (SELECT MAX(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS, (SELECT SYSDATE-1 FROM DUAL))
    It works but not sure if I am getting accurate results. Can anyone help me fine tune this subquery script? Thanks!
    Scott

    Duplicate post
    See my answer in your other posting here Re: need help with script

  • Help with output a.s.a.p .please!!!

    I'm having trouble with outputting everything on the same line in this problem:
    Given an int variable k that has already been declared, use a for loop to print a single line consisting of 97 asterisks. Use no variables other than k
    I've gotten this far:
    for(k=0;k<=97;k++)
    I'm not sure how to output all the asterisks on the same line. Help would be much appreciated.

    Are you going to use System.out, and some method of it which prints a character somewhere in there, or not?

  • Elements 8 -help with outputting slide shows to File?

    Can anyone help with saving a slide show in created in Elements to a file on my laptop? I know a WMV file is created, which option should I select to save in UK widescreen format 16:9?

    Bob, thanks for prompt answer.
    I am ultimately going to write the file to a DVD using Windows DVD Maker. Is the 16:9 format the DVD-PAL 720x576 option, or the High 1024x768 option?

  • PLEASE NEED HELP WITH OUTPUTTING HDV/DV!! 16:9 to 4:3!! NEED HELP NOW!

    ok. I started out with HDV footage. Imported that edited it native HD into final cut 5, didn't downconvert. Now I am trying to output the finished work onto a dv camera through firewire. At first i nested the HDV sequence into a NTSC sequence, but the video wouldn't go through to the camera, only audio. I thought it was a connection problem, but then i played some DV footage and it went to the camera fine. So then i exported the DV sequence as a quicktime movie in NTSC form, but that really cropped the 16:9 footage and made it unwatchable. How can i take the 16:9 HDV footage, and letterbox it so that it fits inside a 4:3 frame without cutting off any of the original frame, and then export that to a DV camera? Let me know if you need more info, please help this is due tomorrow!! ahhhhh!

    When you Export using QuickTime Conversion, to DV Stream, you get an option of what the aspect ratio should be. Select 16:9 and the DV stream will be what you're looking for. Opening that in FCP and sending it to the camera should work out well.

  • Need help with output for D5

    Hi,
    I need some help getting my film in sync to a D5.
    The film was shot on MiniDV and edited drop frame (29.97).
    What we did first is output on miniDV and dubbed that to a D5 for color correction. Everything was in sync with the timeline. Then my friend color corrected. Since then several shots have been replaced, not effecting the timing at all. We checked that everything was hitting at the same timecodes and everything was cool.
    Now I've output another tape onto MiniDV and tried to dub it to D5 but the shots are not hitting at the same timecode. They assure me that everything is drop frame on their end. Not sure what might be causing the problem. Not sure what to try next?
    Need suggestions and ideas.
    thanks.

    if you had a downconvert from your "color corrected d5" you could place it in the timeline and see whats up.

  • Need help with output type EDI for ERS

    All,
    I want to be able to run and ERS settlement and have the invoices created sent via EDI/XML to the supplier.   I have several questions on the set up.
    1)  I have output type ERS6 which is defined as ERS EDI.  I assume because it does not start with Z* this is SAP standard, so I shouldn't have to modify any of this.
    2)  I've added my supplier to this output type. 
    3)  I assume I need to create a partner profile for this supplier?  If so can someone tell me the message type to use?
    Is there any set up I'm missing in this process?   I've executed ERS but do not get an idoc and I'm fairly certain it's because I haven't done the partner profile set-up.
    Thanks for your help.
    Sandra

    Hi,
    You don't have to modify thise setup unless you have any customized requirement.
    You are missing partner profile setup.Carry out the setup and run MRRL tcode to create the idocs
    Enter the following values using tcode WE20.
    Field                                       Value
    Message type                         GSVERF
    Partner type                             LI (vendor)
    Partner function                        LF (vendor)
    Port                                         SUBSYSTEM ( Port to your middleware)
    Output mode                            such as Collect IDocs
    Basic type                                GSVERF01
    Application                                 MR
    Output type                                ERS6 or the type you have defined
    Regards,
    Karuna

  • Need help with 'Output Folder URL'

    How can I compile my application and have it get posted on a
    server?
    When I create a project, in the “Flex Build Path”
    I add my server URL in the 'Output Folder URL' field. But when I
    Run my project, it doesn't even seem to attempt to push any files
    to the server. It just brings up my browser with the path to it,
    which it obviously gets a 404 error. And its going to need a
    username and password to post files to a server. Where would I
    assign theses value to Flex Builder?

    After I installed Apache Ant and tinkered with it for about 5
    hours, I have what initially wanted. The code below will compile,
    copy and launch. I also made a splash logo that appears when its
    building. Ant is a nice utility for automated development.
    Ref:
    http://blog.jodybrewster.net/2008/04/09/installing-ant-in-flex-builder-3/
    http://ant.apache.org/manual/tasksoverview.html
    <project name="buildXIFF" default="main">
    <property name="compiler" value="C:\Program
    Files\Adobe\Flex Builder 3\sdks\3.2.0\bin\mxmlc.exe"/>
    <property name="firefox" location="C:\Program
    Files\Mozilla Firefox\firefox.exe"/>
    <property name="projectURL" value="
    http://vmwinserver2003/flex/tests/XIFF/XIFF.html"/>
    <property name="baseDirectory"
    value="Z:\Documents\Programming\Flex\Tests\XIFF"/>
    <property name="baseServerDirectory"
    value="Y:\flex\tests\XIFF"/>
    <target name="main">
    <splash
    imageurl="file:${baseDirectory}/build/FxAntBuildLogo.png"
    showduration="2000"/>
    <antcall target="compile" />
    <antcall target="copy" />
    <antcall target="launch" />
    </target>
    <target name="compile" description="Build XIFF
    project">
    <echo>Building files in bin directory in
    repository</echo>
    <exec executable="${compiler}">
    <arg line="-file-specs '${baseDirectory}/src/XIFF.mxml'
    "/>
    <arg line="-output= '${baseDirectory}/bin-debug/' "/>
    </exec>
    </target>
    <target name="copy" description="Copy XIFF bin directory
    to server">
    <echo>Copying bin directory from repository to server.
    Overwriting all files in destination directory.</echo>
    <copy todir="${baseServerDirectory}" overwrite="true">
    <fileset dir="${baseDirectory}/bin-debug/"/>
    </copy>
    </target>
    <target name="launch">
    <echo>Launching browser, URL is the project's html
    page on the server.</echo>
    <exec executable="${firefox}" spawn="true">
    <arg value="${projectURL}"/>
    </exec>
    </target>
    </project>

  • Need help with outputing query group names

    I am trying to come up with a way to output group headers, then all the records under each group header etc. It would be easy, except there is a twist with what i want to do.
    Normally if I have this set of data (which I ‘borrowed’ from a site that showed the closest to what I’m looking for):
    Example Table Setup:
    TABLE [Numbers]
    (Name, NUMBER)
    Dave Bosky              843-444-4444
    Dave Bosky              843-555-5555
    Matthew Small        843-111-1111
    Matthew Small      _843-222-2222
    Matthew Small        843-333-3333
    I could use the following code:
    <cfoutput query="somequery" group="name">
            #name#<br>
            <cfoutput>
                    #phonenumber#<br>
            </cfoutput>
            <hr>
    </cfoutput>
    And get this:
    Dave Bosky
    843-444-4444
    843-555-5555
    Matthew Small
    843-111-1111
    843-222-2222
    843-333-3333
    BUT, my actual tables are not set up like this. Rather than recording each name with each record, I would have an ID that is the foreign key for another table.
    Current table set up would look like this:
    TABLE [People]
    (ID, NAME)
    1 Dave Bosky        
    2 Matthew Small  
    TABLE [Phones]
    (PEOPLE_ID, NUMBER)
    1              843-444-4444
    1              843-555-5555
    2              843-111-1111
    2              843-222-2222
    2              843-333-3333
    So this output would actually give me this with my current setup and the query code above:
    1
    843-444-4444
    843-555-5555
    2
    843-111-1111
    843-222-2222
    843-333-3333
    How do I keep my current setup but create a query that achieves the same result from the top? (Output the names from the People table as the group headers, but the data from the Phones table underneath that)

    Thanks! With a little tweaking I got it done.
    In case this might be useful to someone else this is the code I ended up using as a test run for what Im trying to do:
    <cfquery name="testthis" datasource="IRLE">
    SELECT ACCOUNTTYPES.ACCOUNTTYPEID, ACCOUNTTYPES.TYPEDESCRIPTION, ACCOUNTS.ACCOUNTNUMBER, ACCOUNTS.ACCOUNTTYPE, ACCOUNTS.ACCOUNTDESCRIPTION
    FROM ACCOUNTS INNER JOIN ACCOUNTTYPES ON ACCOUNTTYPES.ACCOUNTTYPEID = ACCOUNTS.ACCOUNTTYPE
    WHERE ACCOUNTUSERID = '#Session.UserID#'
    </cfquery>
    <table>
    <th colspan="3" align="center"><u>ACCOUNTS:</u></th>
    <cfoutput query="testthis" group="TYPEDESCRIPTION">
    <tr><td></td>
    <td colspan="2">#TYPEDESCRIPTION# Accounts:<BR></td>
    </tr>
    <cfoutput>
    <tr>
    <td></td>
    <td>#ACCOUNTNUMBER#</td>
    <td>#ACCOUNTDESCRIPTION#</td>
    </td>
    </tr>
    </cfoutput>
    </cfoutput>
    </table>
    Im using MySQL, so all the table names etc have to be capitalized.
    Table setup:
    ACCOUNTTYPES
    ACCOUNTTYPEID
    TYPEDESCRIPTION
    1
    CASH
    2
    TRADE
    ACCOUNTS
    ACCOUNTNUMBER
    ACCOUNTUSERID
    ACCOUNTTYPE
    ACCOUNTDESCRIPTION
    1
    1
    1
    CASH
    2
    1
    2
    BROKERAGE
    Note I also threw in a WHERE clause to only show accounts for the logged in user. (Session.USERID is defined by my code at login)
    All in all the output was:
    ACCOUNTS:
                    CASH Accounts:
                    1              CASH
                    TRADE Accounts:
                    2              BROKERAGE
    Given my data at the moment, that’s what I wanted! Sweet!

  • Help with output to 2 CSV files

    I created a script to parse through AD and output a list of computers that have certain info in the description field and it is working (wouldn't mind some critique if things could be done a better/faster way).  Now, what I am trying to do is split
    the output into 2 CSV files based on what is in the $descwho variable.  But I am not sure where to start (not looking for someone to rewrite the script but point me in the right direction).  I have tried a couple things but so far I have not gotten
    anywhere.
    Function Get-ScriptDirectory {
    if($hostinvocation -ne $null) {
    Split-Path $hostinvocation.MyCommand.path
    } else {
    Split-Path $script:MyInvocation.MyCommand.Path
    #Variable that provides the location of the script
    [string]$ScriptDirectory = Get-ScriptDirectory
    Function Clean-OU {
    #clean OU removes FQDN/RootOU from the start and $computername from the end of the OU string
    Param (
    $OriginalOU,
    $computer
    $ouArray = $OriginalOU.split("/")
    $newOU = $null
    Foreach ($OU in $ouArray) {
    If (($ou -ne "FQDN") -and ($ou -ne "RootOU") -and ($ou -ne $computer)){
    If (!$newOu) {
    $newOU = ".../$ou"
    } Else {
    $newOU += "/$ou"
    return $newOU
    $path = "$ScriptDirectory\ad_report_2.csv" #path to where report is saved
    Get-ADComputer -Filter * -Properties Description,Enabled,MemberOf,CanonicalName | % {
    $computer = $_.Name #name of computer
    $desc = $_.Description #description field associated with computer
    $DistinguishedName = Clean-OU -OriginalOU $_.CanonicalName -Computer $computer #FQDN/RootOU/PROD/WIN7/64bit/LT/PF-123456
    # is PC in the SpecialGroup security group?
    If ($_.memberof -match "SpecialGroup"){[string]$memberOf = "SpecialGroup"}else{$memberOf = "N/A"}
    If ($desc){#if Desc = true
    If (($desc.StartsWith("AEHT")) -or ($desc.StartsWith("VF-")) -or ($desc.StartsWith("Disabeled:"))) {
    $descArr = $desc.Split(":").Trim()
    $descWho = $descArr[0]
    $description = $descArr[1]
    $dwTemp = $descArr[2]
    If ($dwTemp -match "\[IT Support\]"){$dwPrefix = "IT Support"}
    elseif($dwTemp -match "\[App Dev\]"){$dwPrefix = "App Dev"}
    elseIf($dwTemp -match "\[Business\]"){$dwPrefix = "Business"}
    $dwTemp = $dwTemp -replace "\[IT Support\]" -replace "\[App Dev\]" -replace"\[Business\]"
    $descWhen = "$dwPrefix - $dwTemp"
    Write-Host $Computer -NoNewline
    #Write-Host - $memberOf -NoNewline
    #Write-Host - $enabled -NoNewline
    Write-Host - $descWho -NoNewline
    Write-Host - $description -NoNewline
    Write-Host - $descWhen -NoNewline
    Write-Host
    $Record = @{"Computer" = $Computer}
    $record.add("DescByWho",$descWho)
    $record.add("Description",$description)
    $record.add("DescWhen",$descWhen)
    $record.add("OU",$DistinguishedName)
    $record.add("MemberOf",$memberof)
    New-Object PSObject -Property $record |Sort-Object -Property DescByWho | Select Computer, DescByWho, Description, DescWhen, MemberOf, OU
    } | export-csv -path $path -NoTypeInformation

    Hi Mike,
    If you want to divide the output to two csv files based on the variable $descWho, please refer to this script, please also note I havn't tested:
    #modify
    $path1 = "$ScriptDirectory\ad_report_1.csv" #path to where report is saved
    $path2 = "$ScriptDirectory\ad_report_2.csv" #path to where report is saved
    $output1=@()
    $output2=@()
    #modify
    Get-ADComputer -Filter * -Properties Description,Enabled,MemberOf,CanonicalName | % {
    $computer = $_.Name #name of computer
    $desc = $_.Description #description field associated with computer
    $DistinguishedName = Clean-OU -OriginalOU $_.CanonicalName -Computer $computer #FQDN/RootOU/PROD/WIN7/64bit/LT/PF-123456
    # is PC in the SpecialGroup security group?
    If ($_.memberof -match "SpecialGroup"){[string]$memberOf = "SpecialGroup"}else{$memberOf = "N/A"}
    If ($desc){#if Desc = true
    If (($desc.StartsWith("AEHT")) -or ($desc.StartsWith("VF-")) -or ($desc.StartsWith("Disabeled:"))) {
    $descArr = $desc.Split(":").Trim()
    $descWho = $descArr[0]
    $description = $descArr[1]
    $dwTemp = $descArr[2]
    If ($dwTemp -match "\[IT Support\]"){$dwPrefix = "IT Support"}
    elseif($dwTemp -match "\[App Dev\]"){$dwPrefix = "App Dev"}
    elseIf($dwTemp -match "\[Business\]"){$dwPrefix = "Business"}
    $dwTemp = $dwTemp -replace "\[IT Support\]" -replace "\[App Dev\]" -replace"\[Business\]"
    $descWhen = "$dwPrefix - $dwTemp"
    Write-Host $Computer -NoNewline
    #Write-Host - $memberOf -NoNewline
    #Write-Host - $enabled -NoNewline
    Write-Host - $descWho -NoNewline
    Write-Host - $description -NoNewline
    Write-Host - $descWhen -NoNewline
    Write-Host
    $Record = @{"Computer" = $Computer}
    $record.add("DescByWho",$descWho)
    $record.add("Description",$description)
    $record.add("DescWhen",$descWhen)
    $record.add("OU",$DistinguishedName)
    $record.add("MemberOf",$memberof)
    #modify
    New-Object PSObject -Property $record
    if($descWho -like "a*"){ #use if statement to filter the $descwho begin with "a" character
    $output1+=New-Object PSObject -Property $record}
    else{
    $output2+=New-Object PSObject -Property $record}
    $output1|Sort-Object -Property DescByWho | Select Computer, DescByWho, Description, DescWhen, MemberOf, OU|export-csv -path $path1 -NoTypeInformation
    $output2|Sort-Object -Property DescByWho | Select Computer, DescByWho, Description, DescWhen, MemberOf, OU|export-csv -path $path2 -NoTypeInformation
    Best Regards,
    Anna Wang

  • Help with output type

    Hi Gurus,
    I have a requirement to create a print program to trigger the messages which are in waiting status when fulfill some conditions.
    requirememt as follows:
    Heading: Invoice data (ICB for purchased goods) via IDOC
    1. Within Replenishment process the invoice is send by IDOC.
    There are two cases:
    a.process the Idoc immediately, if the Inco terms are ex works
    b.create the Idoc, but donu2019t process it immediately
    When the inbound shipping notification is in the system and the fields u201Ddateu201D (LIKP-PODAT) and u201Ctimeu201D (LIKP-POTIM) has been filled, the invoice  Idoc ( step 2 ) can be posted.
    2. The message output is set on dispatch time 3 ( send with application own transaction )
    3. New message type is needed for these kind of invoice
    4. A new print program check all messages which are still waiting for process and check, if the Inco term is maintained in table Y11L1_34_MM_BART with X in field PROC_IM or the fields in table LIKP-PODAT and LIKP-POTIM are filled (means goods are in the warehouse). When one of these checks are fulfilled, process the Idoc.
    I dont understand,, I didnot work on the output types..
    As per my understadin there are output types when they run some transtion in yellow and they are triggered immediately,
    now they want to collect all the output types(messages) anmd trigger them when fulfilled the two conditions above.
    I see in NACE , the application V3 and a z output type,
    my question is:
    can you provide me a sample program if you have come across , Ithinkn a print program neeed to be developed and assing in the NACE transaction.
    Please let me know the procedure for doing this.
    thanks & regards,
    Nazeer

    Hi,
    Have a reference to the standard program "RSNAST00" which is used for triggering the output types.
    Regards
    Vinod

  • Help with output in a WebDynpro CO...

    hi all,
    I have the following problem, I suppose that follows output of a CO
    - *Structure1*
    -- Attribute1
    -- Attribute2
    -- SubStructure1
    --- Attribute3
    Structure1 corresponds to a table with 3 rows. The SubStructure corresponds to a DropDownbyIndex this within the table.
    I try this
    IGPStructure output = executionContext.getOutputStructure();
    IGPStructure Structure1 = output.addStructure("Structure1");
    Structure1.setAttributeValue("Attribute1",
       wdContext.currentContextElement().getAttribute1());
    Structure1.setAttributeValue("Attribute2",
       wdContext.currentContextElement().getAttribute2());
    IGPStructure SubStructure1 = Structure1.addStructure("SubStructure1");
    SubStructure1 .setAttributeValue("Attribute3",
       wdContext.currentContextElement().getAttribute3());
    but only showed me the last row, What can I do?
    thanks

    Hi,
        From your code it is clear that you are adding only one element.For adding all the three elements
    you need to iterate and add all the three elements.
    IGPStructure output = executionContext.getOutputStructure();
    for(int i=o;i<3;i++){
    IGPStructure Structure1 = output.addStructure("Structure1");
    Structure1.setAttributeValue("Attribute1",
       wdContext.nodeXYZ().getElementAt(i).getAttribute1());
    Structure1.setAttributeValue("Attribute2",
       wdContext.nodeXYZ().getElementAt(i).getAttribute2());
    IGPStructure SubStructure1 = Structure1.addStructure("SubStructure1");
    SubStructure1 .setAttributeValue("Attribute3",
       wdContext.nodeABC().getElementAt(i).getAttribute3());

  • Need help with output please

    Thank you for taking a look ill post my code and then my problem
    import java.util.Scanner;
    public class intrest
        public static void main( String[] args )
         Scanner input = new Scanner( System.in );
            System.out.print("Deposit:");
         double Value =input.nextInt();
         double Rate = 0;
            if (Value >250000 || Value <10000)
              System.out.print("Error: minimum deposit 10,000 and Maximum deposit 250000");
         else if (Value <25000)
              Rate = 2.76;
         else if (Value  <50000)
                    Rate = 3.16;
         else
              Rate = 3.20;
         double Interest = (Value / 100 * Rate);
            System.out.println ("Interest:" +Interest) ;
         System.out.println ("Rate:    " +Rate) ;
    }my goal for this program is to get the interest rate if the value is between 10k and 250k, if its any other value it should bring up an error however when i do input a number out of that range it gives me the error but it also displayes the interest rate and the interest gained although it does not work it out (both stay at 0 which is good),
    i want it to only show the error if the first statement is true "{code}if (Value >250000 || Value <10000){code}" ive tried using "Else If" but its still showing me the interest rate and interest gained, can anyone help would really appreciate it
    thank you very much

    Do a if condition check....if you dont want to use exit...below is the modified code
    import java.util.Scanner;
    public class test
        public static void main( String[] args )
         Scanner input = new Scanner( System.in );
            System.out.print("\n Deposit:");
         double Value =input.nextInt();
         double Rate = 0;
            if (Value >250000 || Value <10000)
              System.out.print("\nError: minimum deposit 10,000 and Maximum deposit 250000");
            else if (Value <25000)
                      Rate = 2.76;                  
                 else if (Value  <50000)
                  Rate = 3.16;
         else 
              Rate = 3.20;          
                 double Interest = (Value / 100 * Rate);
                 if ((Interest != 0) || (Rate !=0))
        System.out.println ("\n\n Interest:" +Interest +"\n\n Rate :"  +Rate);         
    }

  • Need Help with Output Routing...

    Ok, I've spent a few hours trying to figure this out and I give up....here's my question:
    I've got a MOTU Traveler and I'd like to have the Logic Output 1-2 feed its signal to both MOTU Analog Output 1-2 (Main Out) and Analog Output 3-4. I want the same signal going to both places. Basically I have two different sets of speakers I use when I'm finishing up a track and like to A/B between the different speaker sets. I've tried everything in Logic and other then setting up another output in Logic labeled 3-4 and manually switching each channel and bus to that new output, nothing works. I also tried the cuemix console and didn't see anyway to do it in there. The only other thing that seemed to work was using an I/O plugin sending output 1-2 to output 3-4, but the signal was super distorted going into 3-4. Anyone know how to have a single Logic Output (1-2) go to multiple Outputs on a MOTU?

    Hi,
    You can set up another output (3+4) and feed it from a buss that is at unity gain,from the main output 1+2
    Then in your cuemix you can calibrate that output to be the same level as the mains,so when you compare the speakers,the levels stay the same when switching.
    Just make sure to check the physical outputs on your traveler are set to the correct impedance (+4 or -10) to match the main outs.
    Cheers

  • Need help with OutPut message

    My Code's below. I'm having trouble with the out put. Can anyone offer any suggestions?
    import javax.swing.JOptionPane;
    import java.util.Locale;
    import java.text.NumberFormat;
    public class Retail
    public static void main(String args[])
    String firstNum;
    String secondNum;
    String result;
    int prodNum;      //first number to input
    double quantity; //second number to input
    double total;          //total of Prod * Quantity Sold for all items
    // To use American Dollar
    NumberFormat moneyFormat = NumberFormat.getCurrencyInstance( Locale.US );
    // first number entered as string
    firstNum = JOptionPane.showInputDialog( "Enter product number 1-5" );
    // second number entered as string
    secondNum = JOptionPane.showInputDialog( " Enter quantity of items sold" );
    // convert values to type double or int from type string
    prodNum = Integer.parseInt( firstNum );
    quantity = Double.parseDouble( secondNum);
    result = "";
    switch (prodNum)
    case 1: // 1st product
    total = 2.98 * quantity;
    break;
    case 2: // 2nd product
    total = 4.50 * quantity;
    break;
    case 3: // 3rd product
    total = 9.98 * quantity;
    break;
    case 4: //4th product
    total = 4.49 * quantity;
    break;
    case 5:
    total = 6.87 * quantity;
    break;
    default: JOptionPane.showMessageDialog( null, "Wrong product number entered" );
    JOptionPane.showMessageDialog( null, result, "Total Price of Items Purchased", JOptionPane.INFORMATION_MESSAGE );

    basically what it is is it's saying it cannot resolve
    a symbol, but I can't figure out which symbol?Not with the code you just posted, it doesn't. However, the error will tell you exactly what the compiler doesn't recognize. In the meantime, try this:
    import javax.swing.JOptionPane;
    import java.util.Locale;
    import java.text.NumberFormat;
    public class Retail
        public static void main(String args[])
            String firstNum;
            String secondNum;
            String result;
            int prodNum; //first number to input
            double quantity; //second number to input
            double total = 0.0; //total of Prod * Quantity Sold for all items **INITIALIZED **
            // To use American Dollar
            NumberFormat moneyFormat = NumberFormat.getCurrencyInstance( Locale.US );
            // first number entered as string
            firstNum = JOptionPane.showInputDialog( "Enter product number 1-5" );
            // second number entered as string
            secondNum = JOptionPane.showInputDialog( " Enter quantity of items sold" );
            // convert values to type double or int from type string
            prodNum = Integer.parseInt( firstNum );
            quantity = Double.parseDouble( secondNum);
            switch (prodNum)
                case 1: // 1st product
                total = 2.98 * quantity;
                break;
                case 2: // 2nd product
                total = 4.50 * quantity;
                break;
                case 3: // 3rd product
                total = 9.98 * quantity;
                break;
                case 4: //4th product
                total = 4.49 * quantity;
                break;
                case 5:
                total = 6.87 * quantity;
                break;
                default: JOptionPane.showMessageDialog( null, "Wrong product number entered" );
            JOptionPane.showMessageDialog( null, moneyFormat.format(total), "Total Price of Items Purchased", JOptionPane.INFORMATION_MESSAGE );

Maybe you are looking for

  • Unable to load DLL (OraOps9.dll)

    I am trying to use a Web Service to access Oracle database using ODP.NET from download OraWin9204.exe. The Web Service is running on Server 2003 under the (usual) principle "NT AUTHORITY\NETWORK SERVICE" which has read/execute/list folder permissions

  • How to set a default value in dropdown list in Wendynpro ABAP? Help!

    Hi Experts,        I have Webdynpro for ABAP application that shows a DropdownwithKey UI element. 1. I am able to populate the dropdown list. But by default the list is not showing any value. Only when I select a value from the list then it shows it.

  • Need serious help about understanding settings on photoshop for the best quality- please reply is you know a lot about this.

    Ideally I'd like to speak to someone from the UK as I feel I can't write out everything I want to say because it's too confusing and it isn't just one question. I need help with setting photoshop so the images are the best quality on screen and for w

  • Unable to edit Cells in Hyperion Planning:

    Hi, Users are unable to edit cell values in particular webform.Even with Administartor access also unable to edit. After Selecting Particular combination in that form am unable to select another combinations.When i used serch option in the menu.The P

  • Good looking �Look and feel� icons ?

    Good looking �Look and feel� icons ? Where could be found icons , professional looking, like in �Java TM Look and Feel Graphics Repository� site, for use in JtoolBar For various functions in java application program ?