How to do this program?

Hi all.
I would like some help on how to create a program.  Im still very new to the Labview program so any help would be greatful.
Now granted that, heres my issue, ive got an assignment for a class that i have no idea where to start.
Heres the assignment:
You have a discount coupon that gives you a ten cent per gallon discount up to 15 gallons.
You purchase regular gas which is priced at $3.56 a gallon, you give the clerk $30.00 to purchase that much in gas.  After applying the discount, how much would you actually have to pay?
For the controls and indicators, i need to show the Amount Tendered, the Discount, Gallons purchased, the Final Price and Discount Amount.
As ive said above, i have no idea where to start with this.
THanks all.

lorddd337 wrote:
Actually i dont have the math worked out as of yet since i have no idea how to do the math that will apply to the program.
Then you need to work out the math first. This has nothing to do with LabVIEW or programming.
For each terminal, decide if it is an input (something the user controls) or an output (something the program will calculate based on the values of the other controls). Have you done that?
lorddd337 wrote:
Also i dont know which tutorial would work for this.
Whatever you just learned in class is probably sufficient. Else start the tutorials in order to learn the basics.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • 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?

    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

  • 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!

  • [SOLVE] How to install this program (PyIpChanger)?

    Hello!
    I'm new to the forum and I wanted you to help me how to install this program.
    https://otland.net/threads/pyipchanger- … ts.157953/
    It is a ip changer for Tibia, to play in OT servers.
    Since there does not exist in the official repositories nor in the AUR, It is necessary install manually, but I can't figure out
    *Sorry my english, I'm not a native speaker.
    Best wishes!
    Last edited by Rearis (2015-05-10 14:52:48)

    Robg told you how to do this:
    robg wrote:
    Just use pacman to install: pyhon2, python2-pyqt4
    After having done that, you can run main.py using pyhon2.
    So install the software, then run:
    python2 PyIpChanger.py
    Last edited by mrunion (2015-05-07 13:36:31)

  • Download photoshop cc and it get stuck at 2%  -  DSL Download at 6 Mbps - How big is this program and why is it frozen at 2%

    download photoshop cc and it get stuck at 2%  -  DSL Download at 6 Mbps - How big is this program and why is it frozen at 2%

    Jimk88 I would recommend reviewing the download logs to determine the exact error.  You can find details on how to locate the download logs at Error downloading Creative Cloud applications - http://helpx.adobe.com/creative-cloud/kb/error-downloading-cc-apps.html.

  • My safari browser seems to have been taken over by a malicious program called only-search.  Does any one know how to uninstall this program from safari?  I am running osX 10.10.

    My safari browser seems to have been taken over by a malicious program called only-search.  Does any one know how to uninstall this program from safari?  I am running osX 10.10.

    There is no need to download anything to solve this problem.
    You may have installed the "VSearch" trojan. Remove it as follows.
    Malware is always changing to get around the defenses against it. These instructions are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
    Back up all data before proceeding.
    Step 1
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Uninstall any extensions you don't know you need, including any that have the word "Spigot," "Trovi," or "Conduit" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
    Reset the home page and default search engine in all the browsers, if it was changed.
    Step 2
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.vsearch.agent.plist
    Right-click or control-click the line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item named "com.vsearch.agent.plist" selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.vsearch.daemon.plist
    /Library/LaunchDaemons/com.vsearch.helper.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/VSearch
    /System/Library/Frameworks/VSearch.framework
    ~/Library/Internet Plug-Ins/ConduitNPAPIPlugin.plugin
    Some of these items may be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
    The problem may have started when you downloaded and ran an application called "MPlayerX." That's the name of a legitimate free movie player, but the name is also used fraudulently to distribute VSearch. If there is an item with that name in the Applications folder, delete it, and if you wish, replace it with the genuine article from mplayerx.org.
    This trojan is often found on illegal websites that traffic in pirated content such as movies. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect more of the same, and worse, to follow.
    You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that the Internet criminal behind VSearch has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing has not done so, even though it's aware of the problem. This failure of oversight has compromised both Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • Really need help on how to write this program some 1 plz help me out here.

    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    ?Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.?
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)
    For Part 1 this is what i got
    import java.util.Scanner;
    public class Window
         public static void main(String[] args)
              double length, width, glass_cost, perimeter, frame_cost, area, total;
              Scanner keyboard = new Scanner (System.in);
              System.out.println("Enter the length of the window in inches");
              length = keyboard.nextInt();
              System.out.println("Enter the width of the window in inches");
              width = keyboard.nextInt();
              area = length * width;
              glass_cost = area * .5;
              perimeter = 2 * (length + width);
              frame_cost = perimeter * .75;
              total = glass_cost + frame_cost;
                   System.out.println("The Length of the window is " + length + "inches");
                   System.out.println("The Width of the window is " + length + "inches");
                   System.out.println("The total cost of the window is $ " + total);
         Enter the length of the window in inches
         5
         Enter the width of the window in inches
         8
         The Length of the window is 5.0inches
         The Width of the window is 5.0inches
         The total cost of the window is $ 39.5
    Press any key to continue . . .
    Edited by: Adhi on Feb 24, 2008 10:33 AM

    Adhi wrote:
    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.Looks like homework to me.
    What have you written so far? Post it.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    &#147;Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.&#148;
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.So this is where you actually have to do something. My guess is that you've done nothing so far.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)Man, this specification writes itself. Sit down and start coding.
    One bit of advice: Nobody here takes kindly to lazy, stupid students who are just trying to con somebody into doing their homework for them. If that's you, better have your asbestos underpants on.
    %

  • How to solve this program?

    Recently I get this work:
    I need to write one program in Java that running on local or internet browser that can connect to database. This database is located on LAN or Internet database server. This database contain information about machine type, price, status, department, owner, history of used, services served.
    This is multi-user program that many user can using it on one time. Depend on the right of user, he can update, delete these information or not. So if user has right, he can delete and update information. And this program also has tools that user can list type of machine, the number of person on departments, machine configuration, history of working and upgrading; used resourses.
    For example, I want to find how many server HP 3000 that my conpany own, who or which department use, status of them.
    How can I solve? If you have experince in this kind of program, please help me.

    Thanh,
    if the application must be able to run locally and in a web browser then you have the following options:
    Swing: Use ADF JClient and create an Applet that runs stand alone. Thsi way you can sue the web browser to show the Apllet while others run it stand alone as an application
    Swing/JSP: You create one model for the business logic and two views. The ADF JClient view as a Java application to run stand alone on local clients and a JSP client for the web. Its a bit more work to do because you are creating two views, but the result may be worth the effort.
    Question the need for local client: If nobody uses a local database, what's the purpose of having an application that runs locally if not the requirement is for desktop integration? In this case I would create a client for the web browser only.
    Frank

  • My adobe acrobat X1 pro, keeps jamming up? Any ideas how i redownload this program?

    I bought this program, but it keeps locking up. I run my computer with win8.1 and previously I had no problems with it, but now it is locking up and wont do anything.
    Is it possible to re-download it from anywhere? I can't seem to find it!

    Hi Martyn ,
    Please refer to the following link.
    https://helpx.adobe.com/acrobat/kb/acrobat-downloads.html
    Let us know if this helps or not.
    Regards
    Sukrit Dhingra

  • How i run this program in eclipse 3.2

    i have no idea to run program in eclipse.. how can i run this....
    public class AreaOfCircle {
         double radius = 0.0;
         double area = 0.0;
         public AreaOfCircle(double rds) {
              radius = rds;
         public void getArea() {
              area = 3.14 * radius * radius;
              System.out.println("Area Of Circle Is : " + area);
         public static void main() {
              AreaOfCircle obj = new AreaOfCircle(5.3d);
              obj.getArea();
    }

    [First hit looks promising...|http://www.google.com/search?hl=en&q=eclipse+java+tutorial&btnG=Google+Search]

  • Help- I have no idea how to use this program.

    Hi All,
    I am really at a loss at the moment. I am hoping to create a flash document for work in order to present an idea I have. What I am basically wanting to do is to create an interactive workbook for clients on occupational health and safety.
    The problem is, I can visualise what I want but just cannot work out this programme (i mean to the extent I don't even know how to pull in the documents I want) let alone make it interactive.
    I know this is a long shot but is there anyone willing to help me get started with this???
    Thanks,
    Tianna

    check flashbuilder.  it's a program that's easier to use than flash pro and which you can use to create swf projects, too.

  • How to finish this program?

    I realize from reading the rules that we are not supposed to post entire assignments so I'll post the code and only ask about the one part I need. The last part of the assignment is to:
    "// while there is an activity,
    // -print the one with earliest end time i.e. first one - call this A.
    // -Delete all activities in the list that start before the end of the one printed.
    // Note that this will include the first activity.
    // You may do the deletion by shifting up by one notch all activities below
    // the one to be deleted and then decrease the number of activities left by 1.
    Here is the source code:
    * Assignment #1
    * The following program segement is for a program that reads a list
    * of activities (activity-name start-time end-time). The times are
    * entered and displayed in military time. After reading the input, it
    * - echoes back the entered activities
    * - displays the activities in increasing order of end times
    * - and lastly displays the non-overlapping activities.
    * To find the non-overlapping activities, it sorts the activity list in
    * ascending order of end times, then prints the first activity in the
    * sorted list. Next, all activities that start before the printed activity
    * are deleted from the sorted list. Again from the remaining activities,
    * the first one (i.e. the one that ends the soonest) is printed, and all
    * activities that start before the end of this one are deleted. This process
    * is repeated until all non-overlapping activities are printed.
    * Your assignment is to complete the missing segments of the program
    * so it completes the above task. You should only change the methods/segments
    * you are asked to change. Do not change my own methods or other areas.
    * You may test your program with the following data. Run the program twice.
    6
    sleep 0012 0100
    shower 0050 0200
    eat 700 0800
    study 0530 0900
    drive 0700 1000
    lunch 1100 1200
    * Data for the 2nd execution
    5
    sleep 0000 0700
    brush_teeth 0700 0715
    shower 0700 0730
    eat 0630 0730
    study 0710 0900
    import java.util.Scanner ;
    // tActivity class: for a single activity
    class tActivity {
       // declare activity name, start and end times.
       private String name;
       private int startTime, endTime;
       // define a constructor for a new activity
       tActivity () {
           name=null; startTime=endTime=-1;
       // define methods for manipulating the data members.
       // readActivity: reads activity name, start and end times.
      public void read (Scanner input) {
           name = input.next();
           startTime = input.nextInt();
           endTime = input.nextInt();
       // printActivity: Prints the activity name, start and end times.
       public void print() {
           // convert to military time before printing
           String sTime=""+startTime, eTime=""+endTime;
           while (sTime.length() < 4) sTime = "0"+sTime;
           while (eTime.length () < 4) eTime = "0"+eTime;
    System.out.printf("%-20s %6s %9s\n", name, sTime, eTime);
       // getStartTime: returns the activity startTime
       public int getStartTime() {
           return startTime;
       // getEndTime: returns the activity endTime
       public int getEndTime() {
           return endTime;
    // tActivityList: for a list of activities
    class tActivityList {
       private int nActivities;
       private tActivity[] list;
       // constructor for creating activity list
       tActivityList(int nActivities) {
           int i;
           this.nActivities = nActivities;
           list = new tActivity[nActivities];
           for (i=0; i < nActivities; i++) list=new tActivity();
    // read the individual activities into the activity list
    // YOU ARE TO COMPLETE THIS METHOD
    public void read(Scanner scan) {
    for (list.read[i];)
    nActivities[sTime][eTime]=scan.nextInt();
    // display the list of all activities - name, start and end times
    // YOU ARE TO COMPLETE THIS METHOD
    public void print() {
    // sort activity list in ascending order of end times
    // uses bubble sort
    public void sort() {
    tActivity temp;
    boolean sorted;
    int i, passes=0;
    do {
    sorted = true;
    passes++;
    for (i=0; i < nActivities-passes; i++) {
    if (list[i].getEndTime() > list[i+1].getEndTime()) { // swap them
    temp = list[i]; list[i]=list[i+1]; list[i+1]=temp;
    sorted = false;
    } while (!sorted);
    // printNonOverlappingActivities:
    // while there is an activity,
    // -print the one with earliest end time i.e. first one - call this A.
    // -Delete all activities in the list that start before the end of the one printed.
    // Note that this will include the first activity.
    // You may do the deletion by shifting up by one notch all activities below
    // the one to be deleted and then decrease the number of activities left by 1.
    // YOU ARE TO COMPLETE THIS METHOD
    public void printNonOverlapping() {
    int i,j,count=0;
    tActivity temp;
    System.out.println("\n\nTHIS IS THE LIST OF NON-OVERLAPPING ACTIVITIES\n"+
    "-#- ---ACTIVITY NAME---- STARTTIME ENDTIME");
    while (nActivities > 0) {
    // print the first one
    // -Delete all activities in the list that start before the end of the one printed.
    // Note that this will include the first activity.
    // You may do the deletion by shifting up by one notch all activities below
    // the one to be deleted and then decrease the number of activities left by 1.
    public class activities {
    public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int nActivities;
    System.out.print
    ("Enter the total number of activities: ");
    nActivities = scan.nextInt();
    tActivityList acts = new tActivityList(nActivities);
    acts.read(scan);
    System.out.println ("\n\nTHIS IS THE LIST OF ACTIVITIES ENTERED\n"+
    "-#- ---ACTIVITY NAME---- STARTTIME ENDTIME");
    acts.print();
    acts.sort();
    System.out.println ("\n\nTHIS IS THE LIST OF ACTIVITIES SORTED IN ASCENDING ORDER OF END TIMES\n"+
    "-#- ---ACTIVITY NAME---- STARTTIME ENDTIME");
    acts.print();
    acts.printNonOverlapping();
    The first two I think I can do with the read and print functions but I'm having trouble with the third part of the assignment. Does anybody have any suggestions as to how to at least start the third part?

    That was trickier that I thought...
       * printNonOverlappingActivities prints activities which do not occur in the
       * same period as any other activity.
      public void printNonOverlapping() {
        if (nActivities == 0) {
          System.out.println("# The activities list is empty");
          return;
        Activity.printColumnHeadings();
        while (nActivities > 0) {
          // print the first one
          activities[0].print();
          // remember the end time of the one printed.
          int theEndTime = activities[0].getEndTime();
          // -Delete all activities in the list which start before the end of the
          //  one printed. Note that this will include the first activity.
          int i = 0;
          while ( i < this.nActivities ) {
            if (activities.getStartTime() < theEndTime) {
    delete(i);
    i = 0;
    } else {
    i++;
    * deletes the activity at "index" from the activities.
    public void delete(int index) {
    for(int i=index; i<nActivities-1; i++) {
    this.activities[i] = activities[i+1];
    this.nActivities--;
    It took me a while (about an hour) to figure out why it help printing the second row (shower)... you need the else i++; because the delete removes the top row... I think you could also do it by deleting the first row before going into the loop, but after remembering it's endTime.
    Headmaster: I do wish you'd listen, Wymer, it's perfectly simple.
    If you're not getting your hair cut, you don't have to move
    your brother's clothes down to the lower peg, you simply
    collect his note before lunch after you've done your scripture
    prep when you've written your letter home before rest, move
    your own clothes on to the lower peg, greet the visitors, and
    report to Mr Viney that you've had your chit signed.cheers. keith.

  • 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

  • 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

  • How to write this program

    I got one output list .
    In that If I  modify any contents in that output list that will directly affect to the data base contents and replace these contents.
    Please provide  some solution how we can update.

    Some ideas on how to implement the problem that you have.
    Server :
    1. Let the server listen to requests from various clients to join the game.
    2. On receiving a request from a client to play the game add him into a circular list where last node point to the first (Don't forget to hold pointers to first and last nodes ;) ) And each node can store al the details of each client like his host ip, his previous letters and answers, his current score et
    3. Create another thread on the server which picks a client from the circular-list and sends him a letter and wait for that particular client to respond. On getting a response from the client, process the word, give him the score and move on to the next node on the circular list. By doing this a round-robin order can be achieved.
    Note: Sleep isn't of much use on the server as the server has to be awake always expecting requests and responses from the clients.
    Client :
    1. Client can be a thread which connects to server and initial sends a request to join the game and waits for response from the sever which will be the "Letter" with which the client will build a word and sent it back to server and goes to sleep until it gets a response from the server which will be the next letter and current score etc
    2. Client and server have to agree to a protocol so that they can understand each others responses.
    3. If you do not have a network to test this then you can create multiple instances of the client on the same machine and connect all these instances to the server.

Maybe you are looking for