Help in my code
Hi, i need some help in my program.
It is running but it is not doing the right.
The program needs to compares two strings that the user input.
And display the message if the first string is less then the second string, equal, or greater.
import javax.swing.*;
public class Compares
public static void main(String[] args)
String str = JOptionPane.showInputDialog("Welcome!\nEnter the first string: ");
String str2 = JOptionPane.showInputDialog("Enter the second string: ");
if (str2.compareTo(str) == 1)
JOptionPane.showMessageDialog(null, "The first string is less then the second string",
"String Result", JOptionPane.PLAIN_MESSAGE);
else if (str2.compareTo(str) == 0)
JOptionPane.showMessageDialog(null, "The first string is equal to the second string",
"String Result", JOptionPane.PLAIN_MESSAGE);
else
JOptionPane.showMessageDialog(null, "The first string is greater then the second string",
"String Result", JOptionPane.PLAIN_MESSAGE);
}
Read the javadoc more carefully in the future:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
compareTo does not always return -1, 0, and 1.
Instead, it may return any negative number, 0, or any postive number.
int result = str2.compareTo(str);
if (result > 0)
JOptionPane.showMessageDialog(null, "The first string is less than the second string"...);
else if (result == 0)
JOptionPane.showMessageDialog(null, "The first string is equal to the second string"...);
else
JOptionPane.showMessageDialog(null, "The first string is greater than the second string"...);
Similar Messages
-
Search help for material code in VA01
Dear Experts,
In VA01 tcode in item level if user press f4 in the material code then we will get all the f4 helps for few fields.Now i need to add one more field mtart from mara table in the existing search help of material code.
plz suggest me how can i proceed.
If u have any documets regarding adding one more fied to existing search help plz send me.
Thanks & Regards,
farook.
Edited by: farook shaik on Aug 18, 2009 8:58 AMHi,
You can do that using search help exits you would find several threads already posted to the forum for this like below:
Link[Search Help Exits|Search Help Exit;
Regards,
Himanshu -
Help with html code - inserting video into Muse
I am seeking help writing the code to insert a video into Muse. I uploaded video into my Business Catalyst hosting. I need it to autoplay, loop and not show any controls or frames.
When I host video on Vimeo or YouTube, I see markings on the video that is why I am trying to just host in the same place that the files are stored for my website. If there is a way to host on youtube with out any markings showing up on the video I would be open to that too.
I don't want to see any play button or time bar.
Thanks in advance!!Hello,
Just as an FYI - we also have an HTML5 video tool over at MuseThemes.com that achieves this, but works on mobile devices as well. The link above looks like it uses Flash, which isn't common anymore since the release of HTML5 based video.
Simply drag the widget out onto your canvas, and link up your videos / set options like loop, controls visible, etc. It's quite a flexible widget, and there's a complete training video included so you don't get stuck
Check out the widget here
Just wanted to provide another alternative that could be helpful. Cheers!
Steve Harris
MuseThemes.com -
Need help in transcation code ime0
I need help in transaction code ime0. I mean to say what is this TCode doing? What different Drill-down program means? Where I can use this report?
Regards,
SubhasishHi
Please check the link for help
<a href="http://help.sap.com/saphelp_47x200/helpdata/EN/5c/8db33f555411d189660000e829fbbd/frameset.htm">CA - Drilldown Reporting</a>
Hope it helps
Anirban -
Search help and Match code oject
How to create the search help in version 5.0 and 6.0 ? what is elementary search help,collective search help? what is the use of these search helps? where we use elementary and collective searsc helps? what is the difference between searc help and match code object? how to use in reports?where we use search help and F4IF_INT_TABLE_VALUE_REQUEST function module? what is the diffference between them?
Hi Rk,
1) Elementary search helps describe a search path. The elementary search help must define where the data of the hit list should be read from (selection method), how the exchange of values between the screen template and selection method is implemented (interface of the search help) and how the online input help should be defined (online behavior of the search help).
2) Collective search helps combine several elementary search helps. A collective search help thus can offer several alternative search paths.
3)An elementary search help defines the standard flow of an input help.
4) A collective search help combines several elementary search helps. The user can thus choose one of several alternative search paths with a collective search help.
5)A collective search help comprises several elementary search helps. It combines all the search paths that are meaningful for a field.
6)Both elementary search helps and other search helps can be included in a collective search help. If other collective search helps are contained in a collective search help, they are expanded to the level of the elementary search helps when the input help is called.
CREATION:
Go to SE11 Tcode
select search help
give the 'z' search help name and create
select the selection method ur table name eg : 'mara'
dialog module 'display value immediately'.
add the field whatever u want and lpos = 1 and spos = 1 and check import and export parameter.
where left position when displaying and spos = search position
and then save and activate ..
See the links:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee38446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ee45446011d189700000e8322d00/content.htm
pls go through this for search help creation
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
Search Help Exits:
Re: dynamic values for search help
Re: Dynamic search help
Thanks,
Reward If Helpful. -
Can you help with the code to publish Flash to my own domain.
Thank you for your help, I publish the my site to my own domain, I do not use .Mac, I tested your code and ity works well on .Mac, can you help with the code to publish to my own domain.
Thank you againYou appear to have just collected a variety of code snippets and thrown them together, including a section of AS2 code ( gage.onRelease = function() {... )
The suggestion I offered yesterday still stands. You should find a tutorial regarding AS3 and the atan2 function. Beyond that, what you show suggests this is a school assignment. You should seek help from your fellow students and instructor if that is the case. -
My macbook pro intel core duo 2 keeps restarting intermittenly. Help with error code.
I have run a Hardware Test, and it gives the follwing error code. Can anyone tell me what this is? I recently had my logic board replaced within the last 3 months, so it shouldn't be a problem there.
Thank you very much for any and all help.
Error code:
4SNS/I/40000000:TGOH-128.00Online references possible memory issue? Sensors?
https://discussions.apple.com/thread/3140607?start=0&tstart=0
Keep taking it back and they keep switching parts until the problem is gone. -
I need help with this code error "unreachable statement"
the error_
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errors
import java.util.*;
import javax.swing.*;
import java.awt.*;
public class Tools//tool class
private int numberOfToolItems;
private ToolItems[] toolArray = new ToolItems[10];
public Tools()//array of tool
numberOfToolItems = 0;
for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
toolArray[i] = new ToolItems();
}//end for loop
}//end of array of tools
public int search(int id)//search mehtod
int index = 0;
while (index < numberOfToolItems)//while and if loop search
if(toolArray[index].getID() == id)
return index;
else
index ++;
}//en while and if loop
return -1;
}//end search method
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0;
int index;
index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
}//end delete method
public void display()//display method
for(int i = 0; i < numberOfToolItems; i++)
//toolArray.display(g,y,x);
}//end display method
public String getRecord(int i)//get record method
// return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
}//end getrecod
}//end class
Edited by: ladsoftware on Oct 9, 2009 6:08 AM
Edited by: ladsoftware on Oct 9, 2009 6:09 AM
Edited by: ladsoftware on Oct 9, 2009 6:10 AM
Edited by: ladsoftware on Oct 9, 2009 6:11 AMladsoftware wrote:
Subject: Re: I need help with this code error "unreachable statement"
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errorsThe compiler is telling you exactly what the problems are:
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
int index;
index = search(id); //< -----------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
// <<== HERE where is the return statement?
}//end delete method
public String getRecord(int i)//get record method
// return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
}//end getrecod
}//end class -
Install Flex 4
Exit Code: 7
-------------------------------------- Summary --------------------------------------
- 0 fatal error(s), 3 error(s), 1 warning(s)
WARNING: Memory requirements not met for {74EF259F-1DC6-4DEE-866B-0707173D7654}
ERROR: Custom Action for payload {74EF259F-1DC6-4DEE-866B-0707173D7654} Adobe Flash Builder returned error. Failing this payload.
ERROR: The following payload errors were found during install:
ERROR: - Adobe Flash Builder: Install failed
My Pc
Pentium D CPU 2.80GHz, 2.80GHz
992 MB in RAM
HDD: 38.0GB, Used: 23.3GB, Free: 14.7GB
Sistem
Microsoft Windows XP Pro.
Ver. 2002
Service Pack 3
Help to install tehe Flex Build 4, plase.Hi,
I had a similar problem (see error details below) installing on Windows 7 Professional using a domain account which is in the local admin group. I think my problem was due to an @ character in one of the following environment variables:
APPDATA=C:\Users\my_username@my_company.com\AppData\Roaming
HOMEPATH=\Users\my_username@my_company.com
LOCALAPPDATA=C:\Users\my_username@my_company.com\AppData\Local
USERPROFILE=C:\Users\my_username@my_company.com
I solved the problem by creating a local account with a plalin alphabetical username, adding it to the local administrator group and re-running the installer under that account by right clicking and selecting "Run as Administrator".
I got this idea from the following blog posts:
http://www.niallodoherty.com/post.cfm/adobe-flash-builder-4-installation-error-exit-code-7
http://www.joebillman.com/blog/2010/04/flash-builder-4-install-error/
Hope that helps,
Carl
Exit Code: 7
-------------------------------------- Summary --------------------------------------
- 0 fatal error(s), 4 error(s), 0 warning(s)
ERROR: Custom Action for payload {74EF259F-1DC6-4DEE-866B-0707173D7654} Adobe Flash Builder returned error. Failing this payload.
ERROR: The following payload errors were found during install:
ERROR: - Adobe Flash Builder: Install failed
ERROR: - Adobe Flash Player 10 ActiveX: Install failed -
Need help with WMI code that will send output to db
'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
and talks to our server. I also want the code to:
* check the users computer and find all installed patches
* the date the patches were installed
* the serial number of the users computer
* the computer name, os version, last boot up time, and mac address
and then have all this output to a database file. At the command prompt I've tried:
wmic qfe get description, hotfixid
This does return the patch information I'm looking for, but how do I combine that line of code with:
wmic os get version, csname, serialnumber, lastbootuptime
and
wmic nicconfig get macaddress
and then get all this to output to a database file?Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
found lots of good information. I also found a good command that will print information to a text file.
Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
updates enable, that's because we are not allowed to.
This is my code so far.
#if you want the computer name, use this command
get-content env:computername
$computer = get-content env:computername
#list of installed patches
Get-Hotfix -ComputerName $computer#create a text file listing this information
Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)? -
BCM 2007 error: "To help prevent malicious code from running, one or more objects"
Recently we changed our e-mail accounts around to a new domain name. After this switch, BCM no longer allows adding, editing or any other manipulation of contact records. I get an error message saying "To help prevent malicious code from running, one
or more objects in this form were not loaded."
I have tried clearing the forms cache, uninstalling and reinstalling BCM and even adding the old e-mail address back into the Outlook profile and nothing works.
Is there something I have missed somewhere or am I looking at a complete reinstall of Outlook and BCM?
JonHi Jon
Thank you for the update. It could be another Active X Component - BCM 2007 calls several of them
On thing you could do is run a Process Monitor Log to see if perhaps another component is Blocked. To do that try the following:
1. Close Outlook and as many other programs as possible
2. Download and Extract Process Monitor from here -
http://technet.microsoft.com/en-us/sysinternals/bb896645
3. Start Process Monitor
4. Start Outlook
5. Reproduce the error in BCM
6. Stop Process Monitor by going to the File menu and unchecking "Capture Events"
At this point you can try filtering by clicking the Filter Icon (the Funnel) on the menu bar. Click on the Left Drop down at the top of the Dialog and Select "Path"
For the second dropdown select "Contacts" and then filter on "ActiveX Compatibility" (without the quotes)
in my lab, every GUID under HKLM\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility came up with a result of "Name Not Found"
On your system, are there any are present (the Result Column will show "Success")?
If so, then I would check the Compatibility Flag for that one (Hint - if you right-click on an Entry you can select "Jump To" to open Regedit to that location)
- or -
If you would like for me to take a look at it, in Process Monitor Go to the File > Save Menu and save it as a .PML file. Then send it to me at cts-larrymei at live.com
Note - Please ZIP the file prior to sending it
Thanks!
Larry - MSFT
Larry Meinstein -
I need help with my code..
hi guys. as the subject says I need help with my code
the Q for my code is :
write a program that reads a positive integer x and calculates and prints a floating point number y if :
y = 1 ? 1/2 + 1/3 - ? + 1/x
and this is my code
This program that reads a positive integer x and calculates
and prints a floating point number y if :
y = 1 - 1/2 + 1/3 - ? + 1/x
import java.util.Scanner; // program uses class Scanner
class Sh7q2
// main method begins execution of Java application
public static void main( String args[] )
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
int i = 1; // i is to control the loop
int n = 2; // n is suppose to control the number sign
int x; // a positive integer entered by the user
int m;
System.out.println("Enter a positive integer");
x = input.nextInt();
do
m = (int) Math.pow( -1, n)/i;
System.out.println(m);
n++;
i++;
while ( m >= 1/x );
} // end method main
} // end class Sh7q2 when I compile it there is no error
but in the run it tells me to enter a positive integer
suppose i entered 5
then the result is 1...
can anyone tell me what's wrong with my codeThis program that reads a positive integer x and calculates
and prints a floating point number y if :
y = 1 - 1/2 + 1/3 - ? + 1/x
import java.util.Scanner; // program uses class Scanner
class Sh7q2
// main method begins execution of Java application
public static void main( String args[] )
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
int i = 1; // i is to control the loop
int n = 1; // n is suppose to control the number sign
int x; // a positive integer entered by the user
double m;
int a = 1;
double sum = 0;
System.out.println("Enter a positive integer");
x = input.nextInt();
for ( i = 1; a <= x; i++)
m = Math.pow( -1, n+1)/i;
sum = sum + m;
n++;
a++;
System.out.print("y = " + sum);
} // end method main
} // end class Sh7q2is it right :S -
Closing a browser with the help of servlet code
Is it possible to close a browser by using servlet code?
If so please help me with code.
ThanksThis is really a javascript question, but it's:
window.close() -
I want parameter for program name entering with f4 help pls send code
I want parameter for program name entering with f4 help pls send code
Points if helpfulHi,
PROG is a string which indicates the type of the object --- program
u can call the FM as follows
CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
EXPORTING
<b> object_type = 'PROG'
OBJECT_NAME = p_report</b>
ENCLOSING_OBJECT =
SUPPRESS_SELECTION = 'X'
VARIANT = ' '
LIST_VARIANT = ' '
DISPLAY_FIELD =
MULTIPLE_SELECTION =
SELECT_ALL_FIELDS = ' '
WITHOUT_PERSONAL_LIST = ' '
IMPORTING
OBJECT_NAME_SELECTED =
ENCLOSING_OBJECT_SELECTED =
STRUCINF =
TABLES
OBJECTS_SELECTED =
RECORD_TAB =
EXCEPTIONS
CANCEL = 1
WRONG_TYPE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Patil -
Re: How to disable the personalize tab from help-- diag-- custom code in 11i.
Dear,
How to Active this help--diagnostics--custom code--personalize, because i had tried by sys Adminstrator---> Profile--->system and put profile as Utility Diagnostic to my User Level.Hi,
Please refer note:
How To Enable/Disable The Forms Personalization Menu (Doc ID 550626.1)
Please check the above note, and also confirm you logout and login back after making changes to the profile.
Thanks &
Best Regards, -
pavilion G6 power on password forgotten by my friend, just trying to help her. halt code 66158175
This question was solved.
View Solution.Hi,
Try entering: 79830171
Regards,
DP-K
****Click the White thumb to say thanks****
****Please mark Accept As Solution if it solves your problem****
****I don't work for HP****
Microsoft MVP - Windows Experience
Maybe you are looking for
-
Hi, Can I use iCloud as photo storage rather than just backup? Right now, it just syncs the photos from my iPhone. I want to delete some photos from my phone, but keep them in the cloud. I also want to be able to adjust the settings of certain fol
-
IPod Camera Connector for the iPod Touch
I have an iPod Camera Connector for a previous model of iPod. Now that I have an iPod Touch, when I try to use it I get an error message that states this device is not supported. Has iPod created a Camera Connector to upload pictures from a card larg
-
why is adobe requiring me to make a purchase in order for me to create a pdf from word? I paid for the service in April which included unlimited conversions for a year
-
Why is the "other" category for capacity so big?
My 3rd generation nano has a a really large "other" category for capacity. What is filling this up? What can I do to lower it?
-
Console Window keeps popping up for one second then vanishes before I can read it
a console window (with white letters on a black background) keeps popping up for 1 second and then vanishes before i have time to read it - How can i stop that, or how can i capture what is written on the console before it disappears (so that I can t