How to make this program efficient?
Hola Amigos, I'm trying to explore all the possibilities about comparing two arrays. I know the following code is O(n^2) is it possible to make it O(n) without recursion or is recursion the only way. I ask this because we are being taught recursion and I don't quite understand it. I don't see the relation from recursion taught in Discrete Math with the one taught in programming, Thanks.....
public class twoArrays
public static int max = -1;
public static int findMax(int oneArray [], int twoArray [])
for (int i = 0 ; i < oneArray.length ; i ++)
for ( int j = 0; j < twoArray.length ; j++)
max = Math.max(max,Math.max(oneArray,twoArray[j]));
return max;
public static void main (String [] args)
int[] a = {1,5,8,30,80,99,140,160,170,180,190,200};
int[] b = {2,4,7,45,60,85,98,150,155,175,195,205};
findMax(a,b);
System.out.println("The highest value is: " + max);
Ah, one more thing the word "static" how can I call a method from a non-static context. Very confussing for me, thanks again.
To call a non-static method you can use an instance of the class.
Example:
public class twoArrays {
public static int max = -1;
public int findMax(int oneArray [], int twoArray []){//non-static
for (int i = 0 ; i < oneArray.length ; i ++){
for ( int j = 0; j < twoArray.length ; j++) max = Math.max(max,Math.max(oneArray,twoArray[j])); }
return max;
public static void main (String [] args) {
int[] a = {1,5,8,30,80,99,140,160,170,180,190,200};
int[] b = {2,4,7,45,60,85,98,150,155,175,195,205};
( new twoArrays() ).findMax(a,b);/*through an anonymous instance of the class, you can call findMax method */
System.out.println("The highest value is: " + max);
Hope it will help you.
p.d.: max is initialized -1 cause then into findmax, you asure that max will never again has value -1 (the two arrays contains numbers > -1 )so max at least will be higher than -1.
Sorry for my english.
Saludos
Similar Messages
-
How to make this program terminate?
hi,
how to make the code below stop? is is hanging because UnicastRemoteObject has registered it, and no-one has unregistered it?
thanks,
asjf
import java.rmi.*;
import java.rmi.server.*;
public class UniTest extends UnicastRemoteObject implements Remote {
UniTest() throws RemoteException {}
public static void main(String [] arg) throws Exception {
UniTest ut = new UniTest();
}having done some tests it possibly seems linked to the size of the environment
my system is a win2k machine, with sdk 1.4.1_02 from sun
if I run
java UniTest
then that terminates, but if I first run a batch file containing this
set FILL0=aaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnoooooppppp
set FILL1=bbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaa
set FILL2=cccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbb
set FILL3=dddddeeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbccccc
set FILL4=eeeeefffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccddddd
set FILL5=fffffggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeee
set FILL6=ggggghhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffff
set FILL7=hhhhhiiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggg
set FILL8=iiiiijjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhh
set FILL9=jjjjjkkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiii
set FILL0=kkkkklllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjj
set FILLa=lllllmmmmmnnnnnooooopppppaaaaabbbbbcccccdddddeeeeefffffggggghhhhhiiiiijjjjjkkkkk
then it doesn't?
any help would be really appreciated?
asjf -
Please Suggest, How to make this view efficient ?
Hi there,
Could you please suggest me,how to make the following VIEW (QUERY) efficient regarding performance point of view.
CREATE OR REPLACE VIEW XXX_TRX_TO_NUM_V
(ROW_NUM, ORIG_TRX_NUM, TRX_NUMBER, TRX_DATE, PURCHASE_ORDER,INTERFACE_HEADER_ATTRIBUTE6, INTERFACE_HEADER_ATTRIBUTE1, INTERFACE_HEADER_ATTRIBUTE5, BILL_TO_CONTACT_ID, REMIT_TO_ADDRESS_ID, BILL_TO_CUSTOMER_ID, BILL_TO_SITE_USE_ID, ORG_ID)
AS
Select rownum row_num,trx_number orig_trx_num,to_number(a.trx_number) trx_number,a.trx_date,a.purchase_order,a.interface_header_attribute1
,a.interface_header_attribute6,a.interface_header_attribute5,a.bill_to_contact_id
,a.remit_to_address_id,a.bill_to_customer_id,a.bill_to_site_use_id,a.org_id
from ra_customer_trx_all a
where a.trx_number is not null
and a.trx_number not in
(select trx_number
from
(select rownum,/*+ ALL_ROWS ,16 */ r.trx_number,ltrim(rtrim(translate(/*+ ALL_ROWS ,16 */ r.TRX_number,'0123456789',' '), ' ' ), ' ' ) tx
from ra_customer_trx_all r)
where tx is not null)
order by trx_number
Thanks in Advance !
ShahzadI think you have the hints in the wrong place - as far as I was aware, the hint had to come straight after the SELECT/UPDATE/INSERT/DELETE key word - but I could be wrong as I've never really tried it elsewhere. Also, unless the optimiser mode for your database is set to FIRST_ROWS or RULE (god help you!:), ALL_ROWS is the default behaviour.
Basically what you are trying to say is bring me back all ra_customer_trx_all rows that have purely numeric trx_numbers right?
Why, if you need to be able to represent trx_number as a number, do you have non-numeric data in there???? That's a bit dodgy isn't it?
Anyway, what about:
CREATE TABLE dt_test_num (id varchar2(10))
insert
into
dt_test_num
select
chr(47 + rownum)
from
all_tables
where
rownum <= 20
select
to_number(id),
id
from
dt_test_num
where
translate(id,'0123456789',' ') IS NULL
update
dt_test_num
set
id=id||chr(67-rownum)
select
FROM
dt_test_num
select
to_number(id),
id
from
dt_test_num
where
translate(id,'0123456789',' ') IS NULL
/Also, you are selecting rownum and aliasing it. Why? rownum will be assigned before the sort.
HTH
David
Message was edited by:
david_tyler
Hello
Slight correction to the where clause. Art first I thought you didn't need the trim on there, but that was just down to the number sequence in translate...
SQL> select nvl(translate('1A','1234567890',''),'NULL') from dual
2 /
NVL(
NULL
SQL> select nvl(translate('1A','1234567890',' '),'NULL') from dual
2 /
NV
A
SQL> select nvl(translate('1','1234567890',' '),'NULL') from dual
2 /
N
SQL> select nvl(translate('2','1234567890',' '),'NULL') from dual
2 /
NVL(
NULL
SQL> select nvl(translate('2','0123456789',' '),'NULL') from dual
2 /
NVL(
NULL
SQL> select nvl(translate('1','0123456789',' '),'NULL') from dual
2 /
NVL(
NULL
SQL> select nvl(translate('0','0123456789',' '),'NULL') from dual
2 /
N
SQL> select nvl(TRIM(translate('0','0123456789',' ')),'NULL') from dual
2 /
NVL(
NULL
SQL> select nvl(TRIM(translate('1','0123456789',' ')),'NULL') from dual
2 /
NVL(
NULLTranslate still confuses me :-( -
How to make this query efficient
create table temp)au_sa_poi_geocoding2 as select idx, address_form, suburb_form
from temp_au_Sa_poi_geocoding a where idx not in (select idx from gc1_Sa_sub where status='m' ) and exists (select null from sh_poi_small cites c
where upper (trim(a.suburb_form))=c.city)
one table contain round 74214 records while the other has less than that.
the tables were not indexed, i created index using the following commands.
create index sa_idx on temp_au_sa_poi_geocoding(idx)
create index sa1_idx on gc1_sa_sub(idx)
anyhelp would be appreciated.
thankscreate index sa0_idx on temp_au_Sa_poi_geocoding(upper(trim(suburb_form)));
create index sa1_idx on gc1_sa_sub(status,idx); -- instead of only (idx)
create index sh_idx on sh_poi_small (city);
then try as follows
create table temp_au_sa_poi_geocoding2 as select idx,
address_form, suburb_form
from temp_au_Sa_poi_geocoding a where idx not in
(select /*+ index gc1 */ idx from gc1_Sa_sub gc1 where status='m' ) and
exists (select /*+ index_join c a */ null from sh_poi_small cites c
where upper (trim(a.suburb_form))=c.city)
however effects of indexes will vary by cardinality. -
How do I make this program generate a new problem once the button is hit
Here is the code... appreciate any help given
How do I make this program generate a new set of problem when the "NEXT" button is clicked and continue until the END button is hit
package javaapplication3;
import java.awt.GridLayout;
import java.awt.Window;
import javax.swing.*;
import java.awt.event.*;
* @author Sylvester Saulabiu
class Grid extends JFrame{
final int score = 0;
final int total = 0;
Grid(){
//Set Layout of Flashcard
setLayout(new GridLayout(4, 4, 2 , 2));
//Create Panels
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();
final JPanel p1 = new JPanel();
//Create Radio buttons & group them
ButtonGroup group = new ButtonGroup();
final JRadioButton ADD = new JRadioButton("Addition");
final JRadioButton SUB = new JRadioButton("Subtraction");
final JRadioButton MUL = new JRadioButton("Multiplication");
final JRadioButton DIV = new JRadioButton("Division");
p2.add(ADD);
p2.add(SUB);
group.add(ADD);
group.add(SUB);
group.add(MUL);
group.add(DIV);
p2.add(ADD);
p2.add(SUB);
p2.add(DIV);
p2.add(MUL);
//Create buttons
JButton NEXT = new JButton("NEXT");
JButton END = new JButton("End");
//Create Labels
JLabel l1 = new JLabel("First num");
JLabel l2 = new JLabel("Second num");
JLabel l3 = new JLabel("Answer:");
JLabel l4 = new JLabel("Score:");
final JLabel l5 = new JLabel("");
JLabel l6 = new JLabel("/");
final JLabel l7 = new JLabel("");
//Create Textfields
final JTextField number = new JTextField(Generator1());
final JTextField number2 = new JTextField(Generator1());
final JTextField answer = new JTextField(5);
//Add to panels
p1.add(l1);
p1.add(number);
p1.add(l2);
p1.add(number2);
p1.add(l3);
p1.add(answer);
p1.add(l4);
p1.add(l5);
p1.add(l6);
p1.add(l7);
p3.add(NEXT);
p3.add(END);
//Add panels
add(p2);
add(p1);
add(p3);
//Create Listners
NEXT.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int answer1 = 0;
//Grab the numbers entered
int numm1 = Integer.parseInt(number.getText());
int numm2 = Integer.parseInt(number2.getText());
int nummsanswer = Integer.parseInt(answer.getText());
//Set the score and total into new variabls
int nummscore = score;
int nummtotal = total;
//Check if the add radio button is selected if so add
if (ADD.isSelected() == true){
answer1 = numm1 + numm2;
//otherwise check if the subtract button is selected if so subtract
else if (SUB.isSelected() == true){
answer1 = numm1 - numm2;
//check if the multiplication button is selected if so multiply
else if (MUL.isSelected() == true){
answer1 = numm1 * numm2;
//check if the division button is selected if so divide
else if (DIV.isSelected() == true){
answer1 = numm1 / numm2;
//If the answer user entered is the same with th true answer
if (nummsanswer == answer1){
//add to the total and score
nummtotal += 1;
nummscore += 1;
//Convert the input back to String
String newscore = String.valueOf(nummscore);
String newtotal = String.valueOf(nummtotal);
//Set the text
l5.setText(newscore);
l7.setText(newtotal);
//Otherwise just increase the total counter
else {
nummtotal += 1;
String newtotal = String.valueOf(nummtotal);
l7.setText(newtotal);
//Create End listener
END.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// get the root window and call dispose on it
Window win = SwingUtilities.getWindowAncestor(p1);
win.dispose();
String Generator1(){
int randomnum;
randomnum = (1 + (int)(Math.random() * 20));
String randomnumm = String.valueOf(randomnum);
return randomnumm;
public class Main {
* @param args the command line arguments
public static void main(String[] args) {
// TODO code application logic here
JFrame frame = new Grid();
frame.setTitle("Flashcard Testing");
frame.setSize(500, 200);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}Edited by: SirSaula on Dec 5, 2009 4:39 PMExtract code into methods, so that when an action is performed a method is called. That way you can reuse the method for purposes such as resetting textfields to their default values, scores to default values, etc.
You can go one step further and seperate the GUI layer from the processing layer, by deriving classes that for example maintain and calculate a score.
Mel -
Anyone knows how to make this code to netbeans??
anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.util.regex.*;
public class FilterTable {
public static void main(String args[]) {
Runnable runner = new Runnable() {
public void run() {
JFrame frame = new JFrame("Sorting JTable");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object rows[][] = {
{"AMZN", "Amazon", 41.28},
{"EBAY", "eBay", 41.57},
{"GOOG", "Google", 388.33},
{"MSFT", "Microsoft", 26.56},
{"NOK", "Nokia Corp", 17.13},
{"ORCL", "Oracle Corp.", 12.52},
{"SUNW", "Sun Microsystems", 3.86},
{"TWX", "Time Warner", 17.66},
{"VOD", "Vodafone Group", 26.02},
{"YHOO", "Yahoo!", 37.69}
Object columns[] = {"Symbol", "Name", "Price"};
TableModel model =
new DefaultTableModel(rows, columns) {
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
returnValue = getValueAt(0, column).getClass();
} else {
returnValue = Object.class;
return returnValue;
JTable table = new JTable(model);
final TableRowSorter<TableModel> sorter =
new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
JScrollPane pane = new JScrollPane(table);
frame.add(pane, BorderLayout.CENTER);
JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("Filter");
panel.add(label, BorderLayout.WEST);
final JTextField filterText =
new JTextField("SUN");
panel.add(filterText, BorderLayout.CENTER);
frame.add(panel, BorderLayout.NORTH);
JButton button = new JButton("Filter");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String text = filterText.getText();
if (text.length() == 0) {
sorter.setRowFilter(null);
} else {
try {
sorter.setRowFilter(
RowFilter.regexFilter(text));
} catch (PatternSyntaxException pse) {
System.err.println("Bad regex pattern");
frame.add(button, BorderLayout.SOUTH);
frame.setSize(300, 250);
frame.setVisible(true);
EventQueue.invokeLater(runner);
}its okay onmosh.....what we need to
this...forum....is to have a good......relationship
of programmers......and to start with .....we need to
have a good attitude........right.....???.....no
matter how good you are in programming but if you did
not posses the right kind of attitude....everything
is useless.....in the first place....all we
want....is just to ask...some....help....but
conflicts......but unluckily......we did not expect
that there are members in here which......not
good...to follow.....just as suggestion for those
people not having the right kind of attidude...why
can't you do in a very nice message sharing in a very
nice....way....why we need to put some
stupid....stuff...words.....can't you live with out
******* ****....its not.....lastly especially you
have your children right now and people around...that
somehow......idiolize...you even me....is one of
them......but showing but attitude....is not
good......tnx....hope you'll take it this....in the
positive side.....be optimistic...guys....the
world..is not yours....all of us will just past
away....always..remember that one.....treasure..our
stay in this....temporary home.....which...is
world....Whoa. That post seems to be killing my brain.
URK
Join........us..........do not be..........afraid....... -
Hi,
I am working on AQ where I am just sending and receiving simple messages. But the performance is very poor. It takes around 35 seconds to send (enqueue) just 100 messages which is not acceptable for our project. Can someone help me how to make it more efficient. I am using JMS for sending and receiving messages.
Thanks,
SateeshBhagath,
Thanks for your help.
Oracle server we are using is 8.1.7. We are using JDBC client that ships with Oracle client (classes12.zip).
Right now we are working on point to point messages.
I am just wondering whether I need to do any tuning on server.
Your help is greately appreciated.
Here I am pasting sample code that I wrote which may help in finding the problem.
Thank you so much once again for your help.
-Sateesh
import java.sql.*;
import javax.jms.*;
import java.io.*;
import java.util.Properties;
import oracle.AQ.*;
import oracle.jms.*;
public class CDRQueueSender {
private final String DB_CONNECTION = "jdbc:oracle:thin:@dev1:1521:dev";
protected final String DB_AQ_ADMIN_NAME = "dev78";
private final String DB_AQ_ADMIN_PASSWORD = "dev78";
/** DB AQ user agent name and password */
private final String DB_AQ_USER_NAME = "dev78";
private final String DB_AQ_USER_PASSWORD = "dev78";
private QueueConnectionFactory queueConnectionFactory = null;
private QueueConnection connection = null;
private QueueSession session = null;
private Queue sendQueue;
private QueueSender qSender;
public CDRQueueSender() {
try {
Properties info = new Properties();
info.put(DB_AQ_USER_NAME, DB_AQ_USER_PASSWORD);
queueConnectionFactory = AQjmsFactory
.getQueueConnectionFactory(DB_CONNECTION, info);
connection = queueConnectionFactory.
createQueueConnection(DB_AQ_USER_NAME,
DB_AQ_USER_PASSWORD);
session = connection.createQueueSession(
true, Session.AUTO_ACKNOWLEDGE);
connection.start();
sendQueue = ((AQjmsSession) session).getQueue (DB_AQ_ADMIN_NAME,"CDR_QUEUE");
qSender = session.createSender(sendQueue);
catch (Exception ex) {
ex.printStackTrace();
public boolean sendCDRMessage(CDRMessage messageData)
throws JMSException, SQLException {
ObjectMessage objectMessage = session.createObjectMessage(messageData);
try {
qSender.send(objectMessage);
session.commit();
catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
return true;
public void close() throws JMSException {
session.close();
connection.close();
public static void main(String[] args) throws SQLException, JMSException {
int count = 0;
CDRQueueSender qSender = new CDRQueueSender();
long startTime = System.currentTimeMillis();
long endTime;
CDRMessage message;
while(count < 100) {
message = new CDRMessage("filename", 20, "This is testing", count);
qSender.sendCDRMessage(message);
count++;
//qSender.sessionCommit();
endTime = System.currentTimeMillis();
System.out.println("time taken to process 100 records is " +
((endTime - startTime)/1000) + " seconds");
qSender.close(); -
Something keeps trying to download on my mac and I don't know what it is. It is not in the apple store and just comes out nowhere and request for my password to download something and I don't know what it is. How to make this stop? It pops up every single day.
Erica,
I can, with 99.99% certainty, tell you that you are absolutely right in not wanting to download or install this "Helper," whatever it is (but we can be equally certain it would not "help" anything).
I cannot comment as to Oglethorpe's recommendation of 'adwaremedic'; I am unfamiliar with it. His links to the Apple discussion and support pages warrant your time and attention.
It might be really simple -- Trying looking in your Downloads folder, trash anything that you don't know with certainty is something you want to keep, and then Secure Empty your Trash. Then remove the AdBlock extension, LastPass, and Web of Trust extensions to Safari and re-boot. If the issue goes away, still be extraordinarily careful in the future.
Unfortunately, it's probably not going to be that simple to get rid of, in which case I'd then try the line by line editing in HT203987.
I have no further suggestions (other than a complete wipe and re-install...but that's a pain because trying to restore from Time Machine would simply ... restore the Mal).
For the rest of us, please post when you find a solution.
Best.
BPW
(Also, try to edit your second post -- black out your last name on the screenshot and re-post it for others) -
How to program a midi foot controller on Mainstage? Does anyone knows how to program the foot controller with exclusive solo channel in order not to dance "tip tap" while from clean guitar I go to crunch or solo? How to do this programming on Mainstage?
I basically managed to learn how to invert parameters which allows me to be as default in the clean guitar channel and if I switch the first button on the midi foot controller I switch to crunch, but at this point I tryied so hard to programm the second and third button to switch, only through a button in one step, to a third channel for distorsion or a 4th channel for solo guitar but I couldn't figured out how this work can be done!
I would appreciate if anyone could help or share this experience with others who are experiencing the same problem.
Cheers.
F.I cannot seem to get mainstage to recognize my FCB either. I am using IFCB. Anyone figure this out?
Thanks,
Eric -
I bought a composite AV cable with 30 pin connector at a proper apple store for my ipad 2 which no longer works now i have updated to ios7 - please advise how to make this work ?
I have the same problem.
Two similar discussions:
https://discussions.apple.com/message/23081658#23081658
https://discussions.apple.com/message/23281391#23281391
I have not yet seen any official response to the question: "Is the Apple AV Composite cable fully supported with 30pin connector devices upgraded with iOS7 - specifically ? - eg. iPad 2, iPhone 4, iPhone 4s"
If it is not currently supported is that then due to a bug / oversight and in that case is it something that will be fixed in the near future?
Please let us know what feedback you got from asking Apple support. -
How to make this in Adobe Photoshop CS5? PLEASE Help!
Hey guys, i reallllllllly want to know how to make this image in adobe photoshop.... the cone around the forecast track. Can you guys please show me how to do this? Id greatly appreciate it!
There's a lot implied here, but you're not going to get around having to do the following in general:
Use an unmarked map as a background.
Draw shapes on layer(s) above the background and make them partially transparent.
Obviously the key is to draw shapes that express the "cone of uncertainty" exactly as you want it to look, and with a minimum of fuss.
I'd suggest drawing shapes with Path tools, then filling the shapes, applying a stroke (for the edge border), and using masking to hide parts you don't want to show (or which overlap with the other parts you're drawing).
Are you needing to do this over and over or just once?
-Noel -
How to make this effect in Keylight?
Hi, I have question, how to make this effect in Keylight?
I know that this overlay is added here:
http://oi57.tinypic.com/1174fup.jpg
Photos:
http://iv.pl/images/18475588964010299091.jpgKeylight what? All I see is some effect similar to Leave Color, a.k.a the Pleasantville effect that made the rounds 10 years ago. It may require additional masking and otehr effects, but definitely not something that is specifically related to Keylight...
Mylenium -
Really stuck on how to start this program
Okay, I know I should be posting some code here and showing where I've started and such, but I'm pretty lost as to how to start this program. Here's the problem:
2. Making Change:
This application, named ChangeMaker, will take as input a product price and an amount paid,
both floating-point numbers representing euro and cent amounts. The application computes and prints the amount of change due the user, and also expresses the change amount in number of 2-euros, 1-euro, 20-cent, 10-cent, 5-cent, 2-cent, and1-cent coins.
(Assume no change is given in bills, only in coins.)
For example:
Enter product price: 2.32
Enter amount paid: 5.00
Your change is 2.68 euros
1 x 2 euro
3 x 20-cent
1 x 5 cent
1 x 2 cent
1 x 1 cent
You can assume that the amount paid is greater than the product price, and that both inputs are
"euro and cent" amounts: positive numbers with at most two decimal places.3
Now, I know how to print the line asking for product price and enter amount paid, but I cannot figure out how to set up the rest of the code when switching from american USD dollars/coins to euros. I looked up the conversions and they are just intimidating as all get out when trying to take the equivalency of euros to each dollar thats entered and then taking the rest of the USD remainders and represent that in USD coinage. >.< Help is much appreciated thank you.thomas.behr wrote:
random0munky wrote:
... when switching from american USD dollars/coins to euros. I looked up the conversions and they are just intimidating as all get out when trying to take the equivalency of euros to each dollar thats entered and then taking the rest of the USD remainders and represent that in USD coinage.Uhm, your requirement doesn't say anything about converting between USD and EUR. For starters, just write the program without any currency information at all. (That is only flavour anyways.)
For example:
Enter product price: 2.32
Enter amount paid: 5.00
Your change is 2.68
1 x 2
3 x 0.2
1 x 0.05
1 x 0.02
1 x 0.01That deception would never fly in a Red State -- 20 cent piece? 2 cent piece? 2 dollar coin? All this smacks of Socialism! -
How to make my program forcefully errror
hi 2 all
how to make my program forcefully error out even i have to get data
regards
sivaHi Mate,
Just remove the quries which you execute
Thanks
Kash
www.mkashu.blogspot.com -
Hello
How to make labview program to get average value of 200 reading from multimeter (I using using loop) to read voltage from mulmeter but I like to get average value of all of 200 reding how can I do that?
Thanks
Wee
Solved!
Go to Solution.Another idea with less programming - take advantage of the "free" array that comes with a Chart - i.e. the History Data.
1) Wire your DMM data to a Chart. (You can set the chart to invisible if you don't plan on using it in the GUI).
2) Set the Chart History Length to 200 (right click on the chart, click on Chart History Length...)
3) On the block diagram, use the History Data Property Node, wire it to Mean.vi, and you're done.
Easiest running average ever.
Message Edited by Broken Arrow on 04-07-2010 11:36 AM
Richard
Attachments:
EasyAvg.jpg 8 KB
Maybe you are looking for
-
How I fixed the iTunes "freezing when synching" problem
My version of iTunes (the latest version) would freeze whenever I tried to synch. I ran a virus check (found 3 viruses and cleaned them), then I restored my iPod in iTunes, which erases all the music off the iPod. Then I synched the iPod and the prob
-
HT4927 How do I retrieve photos from Time Machine on a new macbook air?
My previous mac book pro had all my photos on it. I thought I saved the library to a disk, but was unsuccessful. I also backed up my photos to my Time machine daily. Once my macbook and coffee got acquainted, it no longer worked. I am unable to retr
-
Hi All i developed 4 reports in Bex. i have to integrate them in WAD. But in the WAD report i have to display the "country" field at the header level dynamically. any body please help me me to do this Thank Krishna
-
Using so_new_document_send_api1 ?
hi there, i am using FM so_new_document_send_api1 for sending emails from z-abap. is there any possibility that i can send the email IMMEDIATELY ? now it is getting into the queue (in SCOT). there we have a job running every 5 minutes which sends th
-
What do these Reader command line parms mean?
--channel=4956.0037FA0C.303535326 --type=renderer /o /eo /l /b /w 984644 /id 1476 TIA, Pete