Help needed to iterat a List in Java
HI,
I am new to Java and I am not sure how to do this.Please help me with following.
I have a List called injuryList which contains all my injury data from database,how do I iterate it with for loop and get my data.
List<InjuryRecord> injuryList = (List<InjuryRecord>)model.get("injuryRecord");
//I have to do something like this...I am not sure how to do it..
for(int i =0; i??? ; i++) (please help me with the middle condition)
injuryList.get(i)
or should I iterate like this:
for (Iterator itr = injuryList.iterator(); itr.hasNext();) {
Object o = itr.next(); }
but how do I pull data from injuryList..Please help me
If possible I want to do with for loop.
Please help...
Thanks,
Darryl.Burke wrote:
Umm.. devote a little time to thinking about this, but with the limited information, I'm guessing a bit..
-- Which class has a method getIjuryNumber() (is there a typo there?)*** Yes, it was a typo,,I just corrected it
-- What is the class of the object returned by injuryList.get (i) (is there a semicolon missing there?)** there is a class called InjuryRecord.java which has all getters and setters ..which I have included in my imports
No semicolon is not missing,,it was typo
-- (Maybe this should come first) Do you understand that a method returns a reference to an object (or void)?*****No, I am not sure about this
>
So, finally, should the parameter to method yyy be a list, or an object retrieved from the list using get (...)?
******I think it should be a List,it doesn't have to though..but I thought if I pass the List I can get each field....How does it work with object??
db
Similar Messages
-
Help needed Displaying ALV Secondary list without using oops concept
Hi Experts
Help needed Displaying ALV Secondary list without using oops concept.
its urgent
regds
rajasekharhi chk this code
******************TABLES DECLARATION*****************
TABLES : VBAP,MARA.
*****************TYPE POOLS**************************
TYPE-POOLS : SLIS.
****************INTERNAL TABLES**********************
DATA : BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
END OF IT_VBAP.
****************TEMPORARY VARIABLES******************
DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
*****************FIELD CATALOG***********************
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
****************LAYOUT*******************************
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
***************VARIANT*******************************
DATA : G_VARIANT LIKE DISVARIANT.
****************SAVE*********************************
DATA : G_SAVE(1) TYPE C.
*****************EVENTS******************************
DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
G_EVENTS TYPE SLIS_T_EVENT.
******************PF STATUS**************************
DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
******************USER COMMAND************************
DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
R_UCOMM LIKE SY-UCOMM.
****************SELECTION SCREEN************************
SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
***************AT SELECTION SCREEN*********************
AT SELECTION-SCREEN.
PERFORM VALIDATE.
**************START-OF-SELECTION**************************
START-OF-SELECTION.
PERFORM GET_DETAILS.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM VARIANT.
PERFORM SAVE.
PERFORM EVENTS.
PERFORM ALV_DISPLAY.
*********************FORMS*******************************************
*& Form validate
text
--> p1 text
<-- p2 text
FORM VALIDATE .
SELECT SINGLE VBELN
FROM VBAP
INTO V_VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'enter valid vbeln'.
ENDIF.
ENDFORM. " validate
*& Form get_details
text
--> p1 text
<-- p2 text
FORM GET_DETAILS .
SELECT VBELN
POSNR
MATNR
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'no details found'.
ENDIF.
ENDFORM. " get_details
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-OUTPUTLEN = 6.
WA_FIELDCAT-SELTEXT_L = 'ITEM'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-OUTPUTLEN = 18.
WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " fieldcat
*& Form LAYOUT
text
--> p1 text
<-- p2 text
FORM LAYOUT .
WA_LAYOUT-ZEBRA = 'X'.
ENDFORM. " LAYOUT
*& Form VARIANT
text
--> p1 text
<-- p2 text
FORM VARIANT .
CLEAR G_VARIANT.
G_VARIANT-REPORT = SY-REPID.
ENDFORM. " VARIANT
*& Form SAVE
text
--> p1 text
<-- p2 text
FORM SAVE .
CLEAR G_SAVE.
G_SAVE = 'A'.
ENDFORM. " SAVE
*& Form EVENTS
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR XS_EVENTS.
XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND XS_EVENTS TO G_EVENTS.
ENDFORM. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
WRITE :/ ' INTELLI GROUP'.
ENDFORM. "TOP_OF_PAGE
*& Form ALV_DISPLAY
text
--> p1 text
<-- p2 text
FORM ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = PF_STATUS
I_CALLBACK_USER_COMMAND = USER_COMMAND
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = G_SAVE
IS_VARIANT = G_VARIANT
IT_EVENTS = G_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " ALV_DISPLAY
*& Form SET_PF_STATUS
text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
ENDFORM. "SET_PF_STATUS
*& Form SET_USER_COMMAND
text
FORM SET_USER_COMMAND USING R_UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'DC'.
READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
SELECT SINGLE MTART
FROM MARA
INTO V_MTART
WHERE MATNR = IT_VBAP-MATNR.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
ELSE.
WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
WRITE :/ 'MATERIAL TYPE :' , V_MTART.
ENDIF.
ENDIF.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'CLOSE'.
CALL TRANSACTION 'SE38'.
ENDCASE.
REPORT Z_ALV_INTERACTIVE MESSAGE-ID ZMSG_50651
LINE-SIZE 100
LINE-COUNT 60
NO STANDARD PAGE HEADING.
******************TABLES DECLARATION*****************
TABLES : VBAP,MARA.
*****************TYPE POOLS**************************
TYPE-POOLS : SLIS.
****************INTERNAL TABLES**********************
DATA : BEGIN OF IT_VBAP OCCURS 0,
VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
END OF IT_VBAP.
****************TEMPORARY VARIABLES******************
DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
*****************FIELD CATALOG***********************
DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
****************LAYOUT*******************************
DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
***************VARIANT*******************************
DATA : G_VARIANT LIKE DISVARIANT.
****************SAVE*********************************
DATA : G_SAVE(1) TYPE C.
*****************EVENTS******************************
DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
G_EVENTS TYPE SLIS_T_EVENT.
******************PF STATUS**************************
DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
******************USER COMMAND************************
DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
R_UCOMM LIKE SY-UCOMM.
****************SELECTION SCREEN************************
SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
***************AT SELECTION SCREEN*********************
AT SELECTION-SCREEN.
PERFORM VALIDATE.
**************START-OF-SELECTION**************************
START-OF-SELECTION.
PERFORM GET_DETAILS.
PERFORM FIELDCAT.
PERFORM LAYOUT.
PERFORM VARIANT.
PERFORM SAVE.
PERFORM EVENTS.
PERFORM ALV_DISPLAY.
*********************FORMS*******************************************
*& Form validate
text
--> p1 text
<-- p2 text
FORM VALIDATE .
SELECT SINGLE VBELN
FROM VBAP
INTO V_VBELN
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'enter valid vbeln'.
ENDIF.
ENDFORM. " validate
*& Form get_details
text
--> p1 text
<-- p2 text
FORM GET_DETAILS .
SELECT VBELN
POSNR
MATNR
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'no details found'.
ENDIF.
ENDFORM. " get_details
*& Form fieldcat
text
--> p1 text
<-- p2 text
FORM FIELDCAT .
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-FIELDNAME = 'VBELN'.
WA_FIELDCAT-OUTPUTLEN = 10.
WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-FIELDNAME = 'POSNR'.
WA_FIELDCAT-OUTPUTLEN = 6.
WA_FIELDCAT-SELTEXT_L = 'ITEM'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-TABNAME = 'IT_VBAP'.
WA_FIELDCAT-FIELDNAME = 'MATNR'.
WA_FIELDCAT-OUTPUTLEN = 18.
WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
APPEND WA_FIELDCAT TO IT_FIELDCAT.
CLEAR WA_FIELDCAT.
ENDFORM. " fieldcat
*& Form LAYOUT
text
--> p1 text
<-- p2 text
FORM LAYOUT .
WA_LAYOUT-ZEBRA = 'X'.
ENDFORM. " LAYOUT
*& Form VARIANT
text
--> p1 text
<-- p2 text
FORM VARIANT .
CLEAR G_VARIANT.
G_VARIANT-REPORT = SY-REPID.
ENDFORM. " VARIANT
*& Form SAVE
text
--> p1 text
<-- p2 text
FORM SAVE .
CLEAR G_SAVE.
G_SAVE = 'A'.
ENDFORM. " SAVE
*& Form EVENTS
text
--> p1 text
<-- p2 text
FORM EVENTS .
CLEAR XS_EVENTS.
XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
XS_EVENTS-FORM = 'TOP_OF_PAGE'.
APPEND XS_EVENTS TO G_EVENTS.
ENDFORM. " EVENTS
*& Form TOP_OF_PAGE
text
FORM TOP_OF_PAGE.
WRITE :/ ' INTELLI GROUP'.
ENDFORM. "TOP_OF_PAGE
*& Form ALV_DISPLAY
text
--> p1 text
<-- p2 text
FORM ALV_DISPLAY .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = PF_STATUS
I_CALLBACK_USER_COMMAND = USER_COMMAND
I_STRUCTURE_NAME =
IS_LAYOUT = WA_LAYOUT
IT_FIELDCAT = IT_FIELDCAT
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = G_SAVE
IS_VARIANT = G_VARIANT
IT_EVENTS = G_EVENTS
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = IT_VBAP
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " ALV_DISPLAY
*& Form SET_PF_STATUS
text
FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
SET PF-STATUS 'STANDARD' EXCLUDING EXTAB.
ENDFORM. "SET_PF_STATUS
*& Form SET_USER_COMMAND
text
FORM SET_USER_COMMAND USING R_UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN 'DC'.
READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
SELECT SINGLE MTART
FROM MARA
INTO V_MTART
WHERE MATNR = IT_VBAP-MATNR.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
ELSE.
WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
WRITE :/ 'MATERIAL TYPE :' , V_MTART.
SUBMIT SLIS_DUMMY WITH P_MATNR EQ IT_VBAP-MATNR
WITH P_MTART EQ V_MTART.
ENDIF.
ENDIF.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
WHEN 'CLOSE'.
CALL TRANSACTION 'SE38'.
ENDCASE.
plz reward if useful -
Help needed creating a linked list program
I have been trying to create a linked list program that takes in a word and its definition and adds the word to a link list followed by the definition. i.e. java - a simple platform-independent object-oriented programming language.
the thing is that of course words must be added and removed from the list. so i am going to use the compareTo method. Basically there a 2 problems
1: some syntax problem which is causing my add and remove method not to be seen from the WordList class
2: Do I HAVE to use the iterator class to go thru the list? I understand how the iterator works but i see no need for it.
I just need to be pointed in the right direction im a little lost.................
your help would be greatly appreciated i've been working on this over a week i dont like linked list..........
Here are my 4 classes of code........
* Dictionary.java
* Created on November 4, 2007, 10:53 PM
* A class Dictionary that implements the other classes.
* @author Denis
import javax.swing.JOptionPane;
/* testWordList.java
* Created on November 10, 2007, 11:50 AM
* @author Denis
public class Dictionary {
/** Creates a new instance of testWordList */
public Dictionary() {
boolean done=false;
String in="";
while(done!=true)
in = JOptionPane.showInputDialog("Type 1 to add to Dictionary, 2 to remove from Dictionary, 3 to Print Dictionary, and 4 to Quit");
int num = Integer.parseInt(in);
switch (num){
case 1:
String toAdd = JOptionPane.showInputDialog("Please Key in the Word a dash and the definition.");
add(toAdd);
break;
case 2:
String toDelete = JOptionPane.showInputDialog("What would you like to remove?");
remove(toDelete);
break;
case 3:
for(Word e: list)
System.out.println(e);
break;
case 4:
System.out.println("Transaction complete.");
done = true;
break;
default:
done = true;
break;
}//end switch
}//end while
}//end Dictionary
}//end main
import java.util.Iterator;
/* WordList.java
* Created on November 4, 2007, 10:40 PM
*A class WordList that creates and maintains a linked list of words and their meanings in lexicographical order.
* @author Denis*/
public class WordList{
WordNode list;
//Iterator<WordList> i = list.iterator();
/*public void main(String [] args)
while(i.hasNext())
WordNode w = i.next();
String s = w.word.getWord();
void WordList() {
list = null;
void add(Word b)
WordNode temp = new WordNode(b);
WordNode current,previous = null;
boolean found = false;
try{
if(list == null)
list=temp;
else{
current = list;
while(current != null && !found)
if(temp.object.getWord().compareTo(current.object.getWord())<0)
found = true;
else{
previous=current;
current=current.next;
temp.next=current;
if(previous==null)
list=temp;
else
previous.next=temp;
}//end else
}//end try
catch (NullPointerException e)
System.out.println("Catch at line 46");
}//end add
/*WordNode.java
* Created on November 4, 2007, 10:40 PM
*A class WordNode that contains a Word object of information and a link field that will contain the address of the next WordNode.
* @author Denis
public class WordNode {
Word object;//Word object of information
WordNode next;//link field that will contain the address of the next WordNode.
WordNode object2;
public WordNode (WordNode wrd)
object2 = wrd;
next = null;
WordNode(Word x)
object = x;
next = null;
WordNode list = null;
//WordNode list = new WordNode("z");
Word getWord()
return object;
WordNode getNode()
return next;
import javax.swing.JOptionPane;
/* Word.java
* Created on November 4, 2007, 10:39 PM
* A class Word that holds the name of a word and its meaning.
* @author Denis
public class Word {
private String word = " ";
/** Creates a new instance of Word with the definition*/
public Word(String w) {
word = w;
String getWord(){
return word;
}zoemayne wrote:
java:26: cannot find symbol
symbol : method add(java.lang.String)
location: class Dictionary
add(toAdd);this is in the dictionary class
generic messageThat's because there is no add(...) method in your Dictionary class: the add(...) method is in your WordList class.
To answer your next question "+how do I add things to my list then?+": Well, you need to create an instance of your WordList class and call the add(...) method on that instance.
Here's an example of instantiating an object and invoking a method on that instance:
Integer i = new Integer(6); // create an instance of Integer
System.out.println(i.toString()); // call it's toString() method and display it on the "stdout" -
Help needed in learning the basics of Java Smart Card and implementation?
Hello every body,
I am trying to develop the applications on java contactless smart cards technology.
Can any body give me the details like how to start?
What are the required softwares and installation procedure and path settings and etc.?
I am the beginner in java smart card application development.
plz help me outDear Friend,
I would advice to divide learning into two main parts: JavaCard technology and contactless RFID cards. For JavaCard technology you can find useful articles on Sun web-site (developers.sun.com/mobility/javacard/articles/javacard1/). For contactless RFID you can find few useful books at Amazon. Regarding software you need JC development kit. How to install it there is an instrunction in JCDK user guide.
If it is not a secret what a javacard contactless card you are going to use in your work?
Yours
Dmitri -
Help needed in Drop down list value input
Hi experts,
My problem is, I added a field on a screen as a drop down list box and passed all the values to it. Everything is fine. But I need to display the field like if there are no input values to be used by the user, the user should be able to enter some value manually which is not in the list. I'm unable to get this facility. Plzz Help me out.
It's really urgent. Points will be rewarded to the solution.hi ,
Here is a sample of code for creating a dropdown list in screen painter , and this has got the solution of your question :
module create_drop_down_box_material output.
select matnr from mara
into table l_tab_mara_matnr
where matkl = 'ZPMBMAT'.
if not l_tab_mara_matnr[] is initial.
select maktx from makt
into l_tab_collect_maktx_frm_db-material_descr
for all entries in l_tab_mara_matnr
where matnr = l_tab_mara_matnr-material_no.
append l_tab_collect_maktx_frm_db.
endselect.
endif.
loop at l_tab_collect_maktx_frm_db into l_wa_collect_maktx_frm_db.
l_wa_mat_descr-key = l_wa_collect_maktx_frm_db-material_descr.
append l_wa_mat_descr to l_tab_mat_descr.
endloop.
name = 'ZCOT_PPT_DTLS-MATERIAL_DESCR'.
call function 'VRM_SET_VALUES'
exporting
id = name
values = l_tab_mat_descr
exceptions
id_illegal_name = 1
others = 2.
free: l_tab_mat_descr,l_tab_collect_maktx_frm_db.
endmodule. " create_drop_down_box_material OUTPUT
Regards,
Ranjita -
Help needed creating vertical bullet list using div tag and css
Hi,
I think there is something quite fundamental that I'm missing when using div tags - I seem to keep running into problems with them.
I'm trying to create a vertical bullet list. It works fine when I try the code on its own as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#techlistcontainer {
/*list-style-type: square;*/
position: absolute;
top: 20px;
left: 0;
z-index: 2;
width: 75%;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 30;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 30;
#techlistcontainer ul {
margin-top: 0;
margin-left: 0;
padding-left: 0;
list-style-type: none;
font-family: Arial, Helvetica, sans-serif;
#techlistcontainer li {
margin-bottom: 8px;
list-style-type: circle;
margin-left: 50px;
padding-right: 30px;
-->
</style>
<head>
</head>
<body>
<div id="techlistcontainer">
<ul id="techlist">
<li>Java Messaging Service (JMS)</li>
<li>Message Driven Beans </li>
<li>Remote Session EJBs with multi-threading</li>
<li>Message Oriented Middleware(MOS) such as Websphere MQ series, Mercator with SAP/ERP</li>
<li>XML messaging</li>
<li>CORBA (Common Object Request Broker Architecture), RMI (Remote Method Invocation)</li>
</ul>
</div>
</body>
</html>
http://www.pa-solutions.co.uk/vertical_list.html
When I insert that into my site template page, its all over the place:
http://www.pa-solutions.co.uk/development.html
I've put the css code into a seperate file http://www.pa-solutions.co.uk/pas.css - I get the same results when its embedded into the html doc.
Please help before I pull all my hair out.
Thanks,
Phil.Unless you know what you're doing with absolute positioning, avoid absolute positioning! Absolute positioning actually takes an element out of the normal HTML document flow and positions it absolutely in relationship with it's first parent with a position other than static - for details read the HTML specs at the W3C.
Ideally you should use the normal HTML document flow. Divs are block level elements meaning that they act like blocks that take up a height (determined by children content) and width (the full width of the page or it's parent container, unless you tell it otherwise).
For your CSS try this:
#techlistcontainer {
width: 75%;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
margin-left: 30;
padding-top: 0;
padding-right: 0;
padding-bottom: 0;
padding-left: 30;
How does that work with your templates? -
Help Needed urgently - MKTCALENDAR button removal from java applet
Hi Experts ,
We have a requirement to remove buttons from the markeing calendar/projects applet .
In Marketing->Search->Marketing Calendar , when we click on search button , result is displayed in the result view . This is a java applet and has a toolbar with buttons like new,save,copy etc,fields with drop down and also the result list below it.
We have the option to prevent the button functionalities by controlling authorization to SAP objects.But my requirement is to completely hide these buttons from getting displayed in the applet view.
Can anyone help me regarding how to remove the buttons from the java applet .
Appreciate the help a lot.
Thanks
Swapna.hii,
checkout my add from, HTH
[http://forums.sun.com/thread.jspa?threadID=5419921&messageID=10885709#10885709]
... kopik -
HELP needed! - burning in list view
This issue is driving me crazy!
I burn many Data CDs & DVDs backing up files.
The preferred format is all to be in LIST VIEW.
Prior to burning, I ensure all enclosing folders & files are in list view.
After burning, the top level is in list view, but all enclosed folders have reverted to ICON VIEW.
This means higgly-piggly non alphabetic files or folders without dates.
I am using OSX 10.4.9. on a G4/MDD and a 15" powerbook
Have tried Toast 6,7, & 8. and Disk Utility.
Also tried locking folder before burning.
PLEASE can someone, HELP!Do yourself a favor (don't you hate that phrase?) and buy Roxio Toast.
Among other things, it allows you to customize the view of burned disks.
Scott -
Help needed for where used list
Hi All,
I want to use where-used list for the logical database BRF(Selection screen 950).When i hit where-used list in SE36
it gives all the programs which use LDB 'BRF' but i want only the programs that use LDB 'BRF' and selection screen 950.
Regards
Divakarhi
good
go through these links
http://help.sap.com/saphelp_nw04/helpdata/en/03/07b4e75eee423aafab88354306eafc/content.htm
THANKS
MRUTYUN -
Need to know how to iterate a list of field from the req xml in page servic
Hi All,
Please help me out with java code in which i am able to iterate a list of field coming in the request xml to my page service class under read(Pageheader header) method of mine queryPagemaintenace class.
package com.splwg.cm.domain.pageService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import com.ibm.icu.math.BigDecimal;
import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
import com.splwg.base.api.businessObject.BusinessObjectInstance;
import com.splwg.base.api.businessObject.COTSInstanceListNode;
import com.splwg.base.api.datatypes.Date;
import com.splwg.base.api.lookup.BusinessObjectActionLookup;
import com.splwg.base.api.service.DataElement;
import com.splwg.base.api.service.ItemList;
import com.splwg.base.api.service.PageHeader;
import com.splwg.shared.common.ApplicationError;
import com.splwg.shared.environ.FieldDefinition;
import com.splwg.shared.environ.ListDefinition;
import com.splwg.shared.logging.Logger;
import com.splwg.shared.logging.LoggerFactory;
* @author
@QueryPage (program = CMUSER, service = CMUSER,
* body = @DataElement (contents = { @ListField (name = USER_GROUP_LIST)
* , @ListDataField (name = USR_GRP_ID)
* , @DataField (name = MESSAGE_TEXT)
* , @DataField (name = USER_ID)
* , @DataField (name = PASSWORD)
* , @DataField (name = LAST_NAME)
* , @DataField (name = FIRST_NAME)
* , @DataField (name = USER_TYPE_FLG)
* , @DataField (name = EMAILID)}),
* actions = { "add"
* ,"read"
* , "delete"
* , "change"},
* header = { @DataField (name = USER_TYPE_FLG)
* , @DataField (name = EMAILID)
* , @DataField (name = LAST_NAME)
* , @DataField (name = FIRST_NAME)
* , @DataField (name = PASSWORD)
* , @DataField (name = USER_ID)},
* headerFields = { @DataField (name = USER_TYPE_FLG)
* , @DataField (name = USR_GRP_ID)
* , @DataField (name = EMAILID)
* , @DataField (name = LAST_NAME)
* , @DataField (name = FIRST_NAME)
* , @DataField (name = PASSWORD)
* , @DataField (name = USER_ID)},
* lists = { @List (name = USER_GROUP_LIST, size = 100, includeLCopybook = false,
* body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))},modules = {})
public class CMUSER extends CMUSER_Gen {
public static final Logger logger = LoggerFactory.getLogger(CMUSER.class);
DataElement root = new DataElement();
PageHeader page = new PageHeader();
protected DataElement read(PageHeader header) throws ApplicationError{
I want to know how can i iterate this USER_GROUP_LIST in my read method and get the USR_GRP_ID field data from it.
A Prompt reply from your end will help me to resolve this issueGuru Sir,
i tried to override the add() method of the framework in that i was able to iterate the field from the list. But now the i am facing there is that i am not able to send back the response to the external system in XML format. I am getting a blank response in my SOAP UI Tool while testing here is the code:
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import com.ibm.icu.math.BigDecimal;
import com.splwg.base.api.businessObject.BusinessObjectDispatcher;
import com.splwg.base.api.businessObject.BusinessObjectInstance;
import com.splwg.base.api.businessObject.COTSInstanceListNode;
import com.splwg.base.api.datatypes.Date;
import com.splwg.base.api.lookup.BusinessObjectActionLookup;
import com.splwg.base.api.service.DataElement;
import com.splwg.base.api.service.ItemList;
import com.splwg.base.api.service.PageHeader;
import com.splwg.shared.common.ApplicationError;
import com.splwg.shared.logging.Logger;
import com.splwg.shared.logging.LoggerFactory;
* @author
@QueryPage (program = CMUSER4, service = CMUSER4,
* body = @DataElement (contents = { @DataField (name = MESSAGE_TEXT)
* , @DataField (name = PASSWORD)
* , @DataField (name = USER_ID)
* , @DataField (name = LAST_NAME)
* , @DataField (name = FIRST_NAME)
* , @DataField (name = USER_TYPE_FLG)
* , @DataField (name = EMAILID)
* , @ListDataField (name = USR_GRP_ID)
* , @ListField (name = USER_GROUP_LIST)}),
* actions = { "add"
* , "delete"
* , "change"
* , "read"},
* header = { @DataField (name = USER_ID)
* , @DataField (name = MESSAGE_TEXT)},
* headerFields = { @DataField (name = USER_ID)
* , @DataField (name = MESSAGE_TEXT)},
* lists = { @List (name = USER_GROUP_LIST, size = 100,
* body = @DataElement (contents = { @DataField (name = USR_GRP_ID)}))}, modules = {})
public class CMUSER4 extends CMUSER4_Gen {
public static final Logger logger = LoggerFactory.getLogger(CMUSER4.class);
DataElement root = new DataElement();
PageHeader page = new PageHeader();
protected PageHeader add(DataElement item) throws ApplicationError{
BusinessObjectInstance boInstance = BusinessObjectInstance.create("CM-USER");
String USR_GRP_ID = null;
try{
logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.USER_ID));
logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.FIRST_NAME));
logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.LAST_NAME));
logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.EMAILID));
// logger.info("Data coming from the Service into the Application is :"+getInputHeader().getString(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID));
// Iterator it = STRUCTURE.
ItemList sourceList = item.getList(STRUCTURE.list_USER_GROUP_LIST.name);
List userGrpID = new ArrayList();
logger.info("The Size of the User Group List here is :"+sourceList.size());
Iterator iter;
if ((sourceList != null) &&
(sourceList.size() > 0)) {
for (iter = sourceList.iterator(); iter.hasNext(); ) {
DataElement myItem = (DataElement)iter.next();
USR_GRP_ID = myItem.get(STRUCTURE.list_USER_GROUP_LIST.USR_GRP_ID);
logger.info("The User Group Id coming in the List here is :"+USR_GRP_ID);
logger.info("Data coming from the Service into the Application is :"+item.get(STRUCTURE.PASSWORD));
boInstance.set("user", item.get(STRUCTURE.USER_ID));
boInstance.set("firstName", item.get(STRUCTURE.FIRST_NAME));
boInstance.set("lastName", item.get(STRUCTURE.LAST_NAME));
boInstance.set("emailAddress", item.get(STRUCTURE.EMAILID));
// COTSInstanceList userGrpList = boInstance.getList("userGroupUser");
// COTSInstanceListNode userGroupList = userGrpList.newChild();
COTSInstanceListNode userGroupList = boInstance.getList("userGroupUser").newChild();
userGroupList.set("userGroup", USR_GRP_ID);
logger.info("Data coming from the Service into the Application is :"+userGroupList.toString());
/*boInstance.set
boInstance.set("userGroup", getInputHeader().getString(STRUCTURE.HEADER.USR_GRP_ID));*/
// UserTypeLookup.constants.TEMPLATE_USER
//if(element.get(STRUCTURE.USER_TYPE_FLG))
//boInstance.set("user", element.get(STRUCTURE.));
boInstance.set("dashboardWidth","200");
boInstance.set("homeNavigationOption","CI0000000574");
boInstance.set("language","ENG");
boInstance.set("toDoEntriesAge1", new BigDecimal(50));
boInstance.set("toDoEntriesAge2",new BigDecimal(100));
boInstance.set("displayProfileCode", "NORTHAM");
String expirationDate = "2100-12-31";
String[] array = expirationDate.split("-");
userGroupList.set("expirationDate",new Date(Integer
.parseInt(array[0]), Integer
.parseInt(array[1]), Integer
.parseInt(array[2])));
//boInstance.set("userGroupUser", userGroupList);
COTSInstanceListNode roleUserList = boInstance.getList("roleUser").newChild();
roleUserList.set("toDoRole","F1_DFLT");
COTSInstanceListNode dataAccessList = boInstance.getList("dataAccessUser").newChild();
dataAccessList.set("dataAccessRole","***");
String expiryDate = "2100-01-01";
String[] array1 = expiryDate.split("-");
dataAccessList.set("expireDate",new Date(Integer
.parseInt(array1[0]), Integer
.parseInt(array1[1]), Integer
.parseInt(array1[2])));
BusinessObjectDispatcher.execute(boInstance,
BusinessObjectActionLookup.constants.FAST_ADD);
page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "User Added Successfully");
page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
}catch(Exception e){
e.printStackTrace();
page.put(STRUCTURE.HEADER.MESSAGE_TEXT, "Caught Exception in the ORMB System. Please reach out to the Admin"+e.getMessage());
page.put(STRUCTURE.HEADER.USER_ID,item.get(STRUCTURE.USER_ID));
return page;
If you can help me to find out what went wrong here while sending the response back it can close my issue. -
Help needed while exporting crystal reports to HTML file format using java
Help needed while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
html file of the report
thanksthe ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM -
*Help Needed* Adding multiple emails/mailing list in the email subscription
Help Needed
Hi,
Can someone help me in adding multiple email address/mailing list in the email subscription for interactive reports in Apex 4.
pls mail me at [email protected]
Regards,
SunnyThe doc does not mention a separator for the email addresses because we only support one email address per subscription. I have logged a task for our next release to look at expanding it and allowing multiple.
-- Sharon -
Java Progrramming HELP, Needed Urgently, T hanks
hey guys,
I have this lab I need to be done tomorrow, its been weeks lol of thinking and figuring things out can someone make it work ? Pleaseeeee !
I feel like going out and yelling for help lol I have been trying to figure this out for weeks now.
I am pasting my Lab and My Codes I did so far, And Please I really need this done today at any rate, all help would be kindly appreciated.
A Java program is required that will produce a number of reports based on the data from the Product file. This file contains the product name, cost, quantity and UPC. The file name must be input. Valid data from the file will be loaded into an array.
A menu will provide the following options: (Note there are changes from previous assignment.)
1 Display of all valid product information including extended price and GST including totals sorted by name.
2 Display of all invalid records sorted by name.
3 Search and display a certain product by name.
4 Sort by UPC and use a binary search and display a certain product by UPC. (valid records)
9 Exit.
Processing requirements:
Input the data from a file and load the records into an object array. Use this object array to produce the above reports.
Code a class definition exactly as given in the following UML.
(For specific students: you may code the UPC as an integer but if not numeric throw an exception that is handled in main. Document your choice in your submission).
Product
? Name : String
? UPC : String
? Cost : Real
? Quantity : Integer
+ Product (Name : String, UPC : String, Cost : Real, Quantity : Integer)
+ Calculate Extended Cost() : Real
+ Calculate GST(): Real
Input Record:
Product name: String
UPC: String
Cost: real
Quantity: integer
Output Reports
1. Display of all product information including extended cost and GST including totals of these 3 fields.
Following is a sample of the output required:
************************ Product Cost REPORT ****************************
Product Cost Quantity Extended Cost GST Total Cost
Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 10,723,160.83
Tissues 98989898989x 1.99 2 3.98 0.20 4.18
TOTALS 10,212,538.10 510,626.91 10,723,165.01
2. Display of all invalid records and the count.
Following is a sample of the output required:
Invalid UPC Records = 1
Count Record
1 Tiara Diamond, 12345678901x, 36020.00, 2
3. Search and display a certain product by name. Display appropriate message if not found.
Following is a sample of the output required:
Enter product name: CrownJewels
CrownJewels 99999999991x 100,000.00 1 100,000.00 5,000.00 $105,000.00
6. Display the product information sorted by name
Following is a sample of the output required:
************************ Product Cost REPORT ****************************
Product Cost Quantity Extended Cost GST Total Cost
CrownJewels 99999999991x 100,000.00 1 100,000.00 5,000.00 $105,000.00
Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 $10,723,160.83
Pearls 88888888881x 10,000.00 1 10,000.00 500.00 $10,500.00
RubyRing 77777777771x 10,000.00 1 10,000.00 500.00 $10,500.00
Tissues 98989898989x 1.99 2 3.98 0.20 $4.18
TOTALS (complete these values) xxx xxx xxx
Java coding requirements for this assignment
Main methods required
1. Load array with all records. Display exception messages only for records that have invalid data in any of the fields. Return array of valid records and logical size.
2. Validate the UPC. Display each report when requested from the menu.
3. Justify the data in the columns. Right justify numeric fields; left justify the alpha fields.
4. A method for each report required in the menu.
Class methods
5. Use the object method for the extended cost.
6. Use the object method for the GST.
You may use additional methods in the main program but do not add any methods in the class definition.
Use DecimalFormat for rounding.
Create an array to hold the objects. Assume that we only need to process a file of a maximum of 500 records but the file may be larger than 500 records.
A Universal Product Code consists of 12 digits. The first digit (from the left) is the UPC type. The next five digits are the Manufacturer code. The next five digits are the product code which is assigned by the manufacturer. The final digit is the check digit. A person can determine the check digit of a Universal Product Code by doing the following:
Step 1: Sum all of the digits in the odd positions together.
0+4+0+1+5+9 = 19
Step 2: Multiply the sum from Step 1 by 3.
3 * 19 = 57
Step 3: Sum all of the digits in the even positions together.
6+2+0+1+8 = 17
Step 4: Sum together the results from Step 2 and Step 3.
17 + 57 = 74
Step 5: Subtract the sum from the next highest multiple of 10.
80 - 74 = 6 [check digit]
TEST DATA:
Step 1: Create 5 or MORE additional records that will test all conditions. Include these in your documentation. Identify what field is tested in your test data. (Example: error in each field of the record, rounding up, rounding down, valid UPC, invalid UPC, formatting of report, file too large
Step 2: Use the file attached.
GODDDDDDDDDDDDDD lol pasting it made me go crazy,
these are my codes so far, HOwever the problem is ONLY DISPLAY MENU SHOWS, nothing else even though i have enough codes that it can show something,
My codes are as follows:
I am working on Eclipse.
import java.util.Arrays;
import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.io.IOException;
* Name : Sana Ghani
* Date : July 10
public class lab56
public static Scanner file;
public static Scanner parse;
public static Scanner input = new Scanner(System.in);
public static Scanner searchInput = new Scanner(System.in);
public static void main(String[] args) throws Exception
Product1[] validProduct = new Product1[500];
int logicalSize = 0;
int menuChoice=0;
String FileName = getFileName();
displayMenu();
switch(menuChoice)
case 1:
displayAllValidRecords(validProduct, logicalSize);
try
// Open an output stream
OutputStream fout = new FileOutputStream ("myfile.txt");
// Print a line of text
new PrintStream(fout).println ("hello world!");
// Close our output stream
fout.close();
// Catches any error conditions
catch (IOException e)
System.err.println ("Unable to write to file");
System.exit(-1);
break;
case 2:
break;
case 3:
binarySearchByName( validProduct,logicalSize);
break;
case 4:
break;
case 5:
break;
menuChoice = displayMenu();
public static void display(Product1[]validProduct, int logicalSize)throws Exception
String Product, UPC;
double Cost;
int Quantity;
for(int index =0; index<logicalSize; index++)
Product = validProduct[index].GetName();
UPC = validProduct[index].GetUPC();
Cost=validProduct[index].GetCost();
Quantity=validProduct[index].GetQuantity();
System.out.println(Product+"\t\t"+UPC+"\t\t"+Cost+"\t\t"+Quantity);
public static String getFileName()
String fileName;
Scanner input = new Scanner(System.in);
System.out.print("Please enter a file name: ");
fileName = input.next();
return fileName;
public static int displayMenu()
int menuChoice;
boolean validFlag = false;
do
System.out.println("\n\n*************************************");
System.out.println(" Product Display Menu ");
System.out.println("*************************************");
System.out.println("(1)Display All Records");
System.out.println("(2)Display All Invalid Records");
System.out.println("(3)Search by Product Name");
System.out.println("(4)Sort by Product Name");
System.out.println("(5)Exit");
System.out.println("*************************************");
System.out.print("Enter your choice(1-5): ");
menuChoice = input.nextInt();
if ((menuChoice >= 1) && (menuChoice <= 5))
validFlag = true;
if (!validFlag)
System.out.println("You have chosen " + menuChoice + ", " + menuChoice +
" is not valid. Please try again");
}while(!validFlag);
return menuChoice;
public static String loadArray(Product1 [] ValidProduct, String fileName)throws Exception
int logicalSize=0;//will always have to declare
String record;//will always have to declare
String Product, UPC;//variable names from
double Quantity;
double Cost;
Scanner file = new Scanner(new File(fileName));//open
record = file.nextLine();//read a line
record = file.nextLine();//read a line
for(int index = 0; index < ValidProduct.length && file.hasNext(); index++)//check to see if the file has data
record = file.nextLine();
parse = new Scanner(record).useDelimiter(",");
String Name = parse.next();
UPC = parse.next();
Cost = parse.nextDouble();
Quantity=parse.nextDouble();
ValidProduct[index] = new Product1 ( Name, UPC, Cost, (int) Quantity);
// create the object-- call the constructor and pass info
logicalSize++;
return logicalSize+".txt";
public static double roundDouble(double value, int position)
java.math.BigDecimal bd = new java.math.BigDecimal(value);
bd = bd.setScale(position,java.math.BigDecimal.ROUND_UP);
return bd.doubleValue();
* This method will print report about valid records
public static void displayAllRecords( Product1[]valid, int ValidProduct,
Product1[] invalid, int InvalidProduct)
// Print valid records
displayAllValidRecords(valid, ValidProduct);
// Print invalid UPC records
displayAllValidRecords(invalid, InvalidProduct);
public static void displayOneRecord(Product1[]valid, int index)
double extendedCost, GST, SumofGST = 0, // Total Extended Cost
totalCost, SumOfTotalCost = 0; // Total Extended Cost + GST
// Print title
System.out.println(leftJustify("Product", 50) +
leftJustify("UPC", 15) +
rightJustify("Cost", 10) +
rightJustify("Quantity", 5) +
rightJustify("Extended Cost", 15) +
rightJustify("GST", 5) +
rightJustify("Total Cost", 13));
extendedCost = valid[index].CalculateExtendedCost();
extendedCost = roundDouble(extendedCost, 2);
GST = valid[index].CalculateGST();
GST = roundDouble(GST, 2);
totalCost = extendedCost + GST;
totalCost = roundDouble(totalCost, 2);
// justify method ensures all values are of the same size
System.out.println(//leftJustify(i+"",3) + ": " +
leftJustify(valid[index].GetName(), 50) +
leftJustify(valid[index].GetUPC(), 15) +
rightJustify(valid[index].GetCost()+"", 10) +
rightJustify(valid[index].GetQuantity()+"", 5) +
rightJustify(extendedCost+"", 10) +
rightJustify(GST+"", 10) +
rightJustify(totalCost+"", 10));
* This method will print report about valid records
public static void displayAllValidRecords( Product1[]valid, int validCounter)
double extendedCost, sumOfExtendedCost = 0, // Total Extended Cost
GST, sumOfGST = 0, // Total GST
totalCost, sumOfTotalCost = 0; // Total Extended Cost + GST
System.out.println("************************ XYZ Product " +
"Cost REPORT ****************************" +
// Print title
System.out.println(leftJustify("Product", 50) +
leftJustify("UPC", 15) +
rightJustify("Cost", 10) +
rightJustify("Qty", 5) +
rightJustify("Extended Cost", 15) +
rightJustify("GST", 5) +
rightJustify("Total Cost", 13));
// Print Records
for(int i=0; i<validCounter; i++)
extendedCost = valid.CalculateExtendedCost();
extendedCost = roundDouble(extendedCost, 2);
GST = valid[i].CalculateGST();
GST = roundDouble(GST, 2);
totalCost = extendedCost + GST;
totalCost = roundDouble(totalCost, 2);
// justify method ensures all values are of the same size
System.out.println(//leftJustify(i+"",3) + ": " +
leftJustify(valid[i].GetName(), 50) +
leftJustify(valid[i].GetUPC(), 15) +
rightJustify(valid[i].getClass()+"", 10) +
rightJustify(valid[i].GetQuantity()+"", 5) +
rightJustify(extendedCost+"", 10) +
rightJustify(GST+"", 10) +
rightJustify(totalCost+"", 10));
sumOfExtendedCost += extendedCost;
sumOfGST += GST;
sumOfTotalCost += totalCost;
private static void sortByName(Product1 [] ValidProduct, int logicalSize) throws Exception
Product1 temp;
for (int outer = logicalSize-1; outer > 1; outer --)
for (int inner = 0; inner < outer; inner ++)
if (ValidProduct[inner].GetName().compareToIgnoreCase(ValidProduct[inner+1].GetName())>0)
temp = ValidProduct[inner];
ValidProduct[inner] = ValidProduct[inner + 1];
ValidProduct [+ 1] = temp;
public static void binarySearchByName(Product1 [] ValidProduct, int logicalSize)
int high = logicalSize - 1;
int low = 0;
int mid = 0;
int count = 0;
int compare = 0;
boolean found = false;
System.out.print("Enter a product name");
String product = input.nextLine();
while (high >= low && !found)
count += 1;
mid = (high + low) / 2;
compare = ValidProduct[mid].GetName().compareToIgnoreCase(product);
if (compare == 0)
System.out.println("Found: " + ValidProduct[mid].GetName());
found = true;
else if (compare < 0)
low = mid + 1;
else
high = mid - 1;
if (!found)
System.out.println(product + " not found.");
System.out.println(count + " steps");
System.out.println();
public static String leftJustify(String field, int width)
StringBuffer buffer = new StringBuffer(field);
while (buffer.length() < width)
buffer.append(' ');
return buffer.toString();
public static String rightJustify(String field, int width)
StringBuffer buffer = new StringBuffer(field);
while (buffer.length() < width)
buffer.append(' ');
return buffer.toString();
public static void displayValidRecords(Product1 [] ValidProduct, int logicalSize) throws Exception {
long longMAX_POSSIBLE_UPC_CODE = 999999999999L;
// set input stream and get number
Scanner stdin = new Scanner(System.in);
System.out.print("Enter a 12-digit UPC number: ");
long input =stdin.nextLong();
long number = input;
// determine whether number is a possible UPC code
if ((input < 0)|| (input > longMAX_POSSIBLE_UPC_CODE)) {
// not a UPC code
System.out.println(input +"is an invalid UPC code");
else {
// might be a UPC code
// determine digits
int d12 = (int) (number % 10);
number /= 10;
int d11 = (int) (number % 10);
number /= 10;
int d10 = (int) (number % 10);
number /= 10;
int d9 = (int) (number % 10);
number /= 10;
int d8 = (int) (number % 10);
number /= 10;
int d7 = (int) (number % 10);
number /= 10;
int d6 = (int) (number % 10);
number /= 10;
int d5 = (int) (number % 10);
number /= 10;
int d4 = (int) (number % 10);
number /= 10;
int d3 = (int) (number % 10);
number /= 10;
int d2 = (int) (number % 10);
number /= 10;
int d1 = (int) (number % 10);
number /= 10;
// compute sums of first 5 even digits and the odd digits
int m = d2 + d4 d6 d8 + d10;
int n = d1 + d3 d5 d7 + d9 + d11;
// use UPC formula to determine required value for d12
int r = 10 - ((m +3*n) % 10);
// based on r, can test whether number is a UPC code
if (r == d12) {
// is a UPCcode
System.out.println(input+" is a valid UPC code");
else {
// not a UPCcode
System.out.println(input+" is not valid UPC code");
Any help would be great thanks !!
Take care,1) It's your problem that you waited until the last minute before you went for help...not ours. We'll give your problem the same attention as anyone elses...therefore your problem isn't any more urgent than any other problem here.
2) I don't intend on doing your entire assignment. Nor do I intend on reading all of it. If you need help with a specific requirement, then post the information/code relevant to that requirement. I don't know how to help you when you bury the problem inside a 9 mile long essay.
3) Post code in tags so it's formatted and readable. (there's a *code* button up above that makes the tags for you). -
Help Needed in Creating Java Class and Java Stored Procedures
Hi,
Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
I have seen the Documents. But i couldn't able to understand it correctly.
I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
Is that possible to Create a Java class in the oracle Database itself ?.
Where are the files located for the existing Java Class ?..
Help Needed Please.
Thanks,
Murali.vHi Murali,
Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
Configure deployment to a database to upload the java file instead of class
The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
Hope this helps,
Sunil.. -
hi,
i need to make a list in which all the list items will come
from xml file. these items will also be clickable so that they open
a new respective hyperlink on click. i need something like
www.sponky.com ' s portfolio list. can somebody please help me? i
really need your help.
thanks,
gauravI'm hoping I understand what you're doing... I would probably
do it all in one frame and just toggle the .visible property of the
subcategory list after the first one has been clicked, but there's
no rules about how you do it.
Without being sure, I think what you may have done is put a
second "copy" of the category list on another keyframe, which
replaces the previous instance. By taking away the second copy it
should work. If that's not the case, then I'm stumped... otherwise
read on.
So if you have the category list in its own layer, just have
it in frame one, on frame 2 of the same layer have a frame but
not a keyframe. This will mean the instance in frame one is
still the same one when the playhead gets to frame 2.
And have the subCategory list on a separate layer, it appears
on frame 2...
BTW the .getSelectedItem() method of the list reminds me of
flash mx... is that the version you're using (curiosity only I
don't think its relevant, because its obviously working).
Maybe you are looking for
-
How to put a side-value to a svg
Hello, how can I put a page-item-value to a svg? SELECT NULL ,v.datum ,round(v.q_month,2) wert FROM v_mp v WHERE v.datum >= add_months(SYSDATE,-1) AND v.PC = :P1_PCThe result is 'no data found' SELECT NULL ,v.datum ,
-
Does Elements 9 Support New Nikon D7000?
Any News on whether the new Elements 9 software will support the new Nikon D7000?. I see where it does support Nikon's NEF Raw Format but can find nothing about Supporting the Nikon D7000 due to be released to stores the middle of October.
-
Hi Gurus/Experts I want to apply an outer join on a fact and dimension table. I am very new to OBI and have no idea of how to go about it. i had read a few links which says creating an opaque view etc but have not got a clear picture. Quick response
-
Hi.... sunder here.... Im facing a problem from flash/IE 7.0.. pls can any one help me out..... i have done a intro in flash, which is inside a movieclip in frame 2 of timeline, and i have put a preloader in frame 1, so that the movie loads fully bef
-
Scrolling thumbnails and Tearing
See the following video http://ntbone.homeip.net/public_html/LightroomScrolling.wmv This tearing that appears while scrolling with the wheel is annoying and painful to the eyes. It makes scrolling through photos horrible. I have a Core i7, 12 gigs o