Help with RMI university assignment

Hi everybody,
The assignment asks for the definition of three remote interfaces ICompany, IProject and IStaff, define one 1:M relationship (ICompany -> IProject) and print on the console the company together with the projects they have placed. There is no requirement for a DB therefore i've create a method on the server
populateDummyDB(ProjectImpl proj)that fills a Vector with projects with their coresponding company ID's.
I've also created a company instance on the server which i successfully print on the client by callingprintCompany(Object obj) but i need help with theprintProjects() so that as soon the company is printed it searches the Vector for projects that have the same companyID matches the PK with the FK and print those projects.
Any help will be more than welcome.
Regards,
Nick Paicopoulos
BSc Applied Computing.

Thanks for the reply and sorry for the vagueness.
The company is created and bound to RMI on the Server
CompanyImpl myCom = new CompanyImpl("101234", "WH Smith",
                    "Nick Parks", null);
myCom.bindToRMI("com1"); also on the Server the Vector that is defined in the ProjectImpl.java is populated
public static void populateDummyDB(ProjectImpl proj)
            throws RemoteException {
        proj.addProject(new ProjectImpl("Project A", "10 Feb 2005", 11000,
                "101234", null, null));
        proj.addProject(new ProjectImpl("Project B", "16 Feb 2005", 8700,
                "178745", null, null));
        proj.addProject(new ProjectImpl("Project C", "19 Feb 2005", 17400,
                "130928", null, null));
        proj.addProject(new ProjectImpl("Project D", "27 Feb 2005", 12800,
                "178745", null, null));
        proj.addProject(new ProjectImpl("Project E", "04 Mar 2005", 9760,
                "101234", null, null));
        proj.addProject(new ProjectImpl("Project F", "09 Mar 2005", 5340,
                "178745", null, null));
        proj.addProject(new ProjectImpl("Project G", "13 Mar 2005", 15290,
                "101234", null, null));
        proj.addProject(new ProjectImpl("Project H", "17 Mar 2005", 5780,
                "101234", null, null));
        proj.addProject(new ProjectImpl("Project I", "23 Mar 2005", 20100,
                "130928", null, null));
        proj.addProject(new ProjectImpl("Project J", "30 Mar 2005", 6780,
                "130928", null, null));
} The company is printed successfully on the Client
public class HKClientView{
    public static void main(String[] args) {
        HKClientView cmdUI = new HKClientView();
    public static final String SERVER_NAME = "localhost";
    public HKClientView() {
        ICompany yourCom = getRemoteCompany();
        try {
            CompanyTO yourComData = yourCom.getCompanyData();
            printCompany(yourComData);
//            printProjects();
        } catch (RemoteException re) {
            System.out.println("Exception thrown while creating company "
                    + "instance! " + re);
    private ICompany getRemoteCompany() {
        ICompany myCompany = null;
        ProjectImpl myProject = null;
        try {
            myCompany = (ICompany) Naming.lookup("//" + SERVER_NAME + "/com1");
        } catch (Exception e) {
            System.out.println("Exception thrown while creating company "
                    + "instance! " + e);
        return myCompany;
    private void printCompany(Object obj) {
        System.out.println(obj.toString());
} If you look closely at my dummy DB table four out of the ten projects belong to the company that i've created since the have common companyID = "101234". How can i get those projects printed on the Client?
Regards,
Nick Paicopoulos.

Similar Messages

  • Please help me with my University assignment !!!

    Hi
    I really need help with my java assignment for university. Please look at the details of the assignment in the link below. I have to get this done by the 27th of this month. Any help would be greatly appreciated.
    http://mercury.tvu.ac.uk/sdv/sdv_ass2r.html
    Any links to tutorials would be brilliant.

    That reaction is kind of understandable by the way, do you have any idea just how many students try to get their homework done here, especially this time of the year?
    It would help us to help you if you told us what exactly is the problem you have. Asking for help in general is fruitless - no one has time to walk you through it.
    From the page you posted a link to, this is what you need to do first:    * build a hierarchy of classes to represent the different vehicle types:
              o build a class Vehicle to hold details common to all vehicles
                (see Week 5 Building a class)
              o extend class Vehicle to give the two classes
                Car holds details particular to a car
                Van holds details particular to a van
                (see Week 6 Extending a class)
        * build the main application class RentalCentre which:
              o has the method main so is the class which is to be run
                (see Weeks 5 and 6 - the test classes)
              o has refereneces to the vehicles held by the centre; this is an array of Vehicles
                (see Week 7 Arrays)Do you know how to do all of that? You are also given some code for those classes so you don't need to start from ground zero, I see. What about the rest, adding the definitions for methods and fields (or "attributes" like the page calls them) to the classes and implementing the methods?

  • Help with RMI tutorial (and Eclipse)

    Hi!
    I need a little help with RMI tutorial. I have all source files from tutorial downloaded, but I never did anything like this and don't know, how to run it. I somehow did Building a JAR File of Interface Classes from [http://download.oracle.com/docs/cd/E17409_01/javase/tutorial/rmi/compiling.html], but got stuck on simple HTTP server, I didn't understand, what to do.
    Bonus question: is it possible to do those commands from Eclipse? How?
    Thanks a lot!

    It seems that the example provided (in the link) requires a web serverNo it doesn't. It requires an HTTP server.
    tomcat will be a better option which you can useThe Apache HTTP server might be more to the point.
    But If you are new to RMI and need to understand the exact flow of RMI I think this will not be a better exercise to start withI agree. I would get it running without the codebase feature. This isn't as widely used as you might think, and anyway it is a deployment option not something you need to engage with much when developing.
    @OP: ignore the HTTP stuff and the codebase feature and build 3 JAR files:
    (a) the common stuff (remote interface, stubs if any, and any classes referecned by the remote interface)
    (b) the server (the remote object itself and anything server-side it uses)
    (c) the client.
    The common JAR file should be deployed to both the server and the client, and both the other JARs should name it in their Class-Path entry in the manifest.

  • Help with JAVA StringObject - & assign user input; StringMethod

    Hi Everyone! I need help with this Java Program, I need to write a program, single class, & file. That will prompt the user to enter a word. The output will be separted by hypens and do this until the user enters exit. I think this is done by using a string variable. Then use the length of the word to setup a loop to print each letter out with hypens. (example c-a-t)
    1. I think I should store the word like this: Word.Method(). Not sure of this the API was confusing for me because I wasn't sure of what to do.
    2. A string method to find out how many letters are in the user's word in order to setup a loop to print each letter out. I think I can use a While loop to accomplish this?
    3. A string method to access each letter in a string object individually in order to print individual letters to the screen with those hypens. This is really confusing for me? Can this be accomplished in the While loop? or do I declare variables in the main method.
    Any examples you can refer me to would be greatly appreciated. Thanks

    Getting user input:
    This may look strange to a newbie but there's nothing much you can do since you wanted a single class file:import java.io.*
    public class InputTest {
       public static void main(String[] args) {
          BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Hi! Please type a word and press enter.");
          String lineReadFromUser = in.readLine();
          System.out.println("You typed " + lineReadFromUser);
    }You can get the lenght of a String using the length() method. Example: int len = "Foobar".length();
    You can get the individual characters of a String with the charAt() method. Example: char firstCharOfString = string.charAt(0);
    (remember that the argument must be from 0 to length-1)
    You can access the documentation of all classes, including java.lang.String, at http://java.sun.com/j2se/1.3/docs/api/index.html You can also download the docs.

  • Help with RMI using inheritance program

    Hi all, im having trouble starting (and finding info on how to) to convert this program to use RMI. I have just completed re-structuring the program to use extended inheritance along with a Access Database.
    Whats the first step i need to take.
    Any help will be much appreciated. THANKS ALL
    import java.sql.*;
    import javax.swing.*;
    import java.util.*;
    public class Database {
       public java.sql.Connection connection;
       public void connect() 
          String url = "jdbc:odbc:groupTask2";  
          String username = "admin";   String password = "teama";
          // Load the driver to allow connection to the database
          try {
             Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
             connection = java.sql.DriverManager.getConnection(url, username, password );
          catch ( ClassNotFoundException cnfex ) {
             System.err.println("Failed to load JDBC/ODBC driver->"  + cnfex);
          catch ( SQLException sqlex ) {
             System.err.println( "Unable to connect->" + sqlex );
       public void showTeams()
          java.sql.Statement statement;
          java.sql.ResultSet resultSet;
          try {
             String query = "SELECT Team_name FROM Team_class";
             statement = connection.createStatement();
             resultSet = statement.executeQuery( query );
             displayResultSet( resultSet );
             statement.close();
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void showPlayers()
          java.sql.Statement statement;
          java.sql.ResultSet resultSet;
          String team = null;
          try {
             String s = JOptionPane.showInputDialog("Please select Team: \n\n1. Panthers \n2. Quails \n3. Bears \n4. Nevils \n ");
             int a = Integer.parseInt(s);
             switch (a){
                 case 1: team = "Panthers";
                         break;
                 case 2: team = "Quails";
                         break;
                 case 3: team = "Bears";
                         break;
                 case 4: team = "Nevils";
                         break;
             String query = "SELECT player_id, First_name, Last_name FROM Player_class WHERE Team_name LIKE '"+team+"'";
             statement = connection.createStatement();
             resultSet = statement.executeQuery( query );
             displayResultSet( resultSet );
             statement.close();
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void update()
          java.sql.Statement statement;
          java.sql.Statement statement2;
          java.sql.ResultSet resultSet;
          String field = null;
          try {
             String a = JOptionPane.showInputDialog("Please Enter the player ID:");
             int id = Integer.parseInt(a);
             String b = JOptionPane.showInputDialog("Which field would you like to update? \n\n1. First name \n2. Last name \n3. Address \n ");
             int choice = Integer.parseInt(b);
             switch (choice){
                 case 1: field = "First_name";
                         break;
                 case 2: field = "Last_name";
                         break;
                 case 3: field = "address";
                         break;
             String val = JOptionPane.showInputDialog("Please enter new " +field);
             String query = "UPDATE Player_class SET "+field+" = '"+val+"' WHERE player_id = "+id;
             statement = connection.createStatement();
             statement.executeQuery( query );
             statement.close(); 
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void displayResultSet( ResultSet rs )
          throws SQLException
          // position to first record
          boolean moreRecords = rs.next();  
          // If there are no records, display a message
          if ( ! moreRecords ) {
                System.out.println( "ResultSet contained no records" );
                return;
          System.out.println( "" );
          try {
             java.sql.ResultSetMetaData rsmd = rs.getMetaData(); 
             // Get column heads
             for ( int i = 1; i <= rsmd.getColumnCount(); ++i ) {
                 System.out.print(rsmd.getColumnName( i ) + "\t");
             System.out.println();
             do {// get row data
                  displayNextRow( rs, rsmd );
             } while ( rs.next() );
          catch ( SQLException sqlex ) {
             sqlex.printStackTrace();
       public void displayNextRow( ResultSet rs, 
                                  ResultSetMetaData rsmd )
           throws SQLException
          for ( int i = 1; i <= rsmd.getColumnCount(); ++i )
             switch( rsmd.getColumnType( i ) ) {
                case java.sql.Types.VARCHAR:
                      System.out.print (rs.getString( i )+"\t\t" );
                   break;
                case java.sql.Types.INTEGER:
                      System.out.print ( rs.getLong( i ) + "\t\t") ;
                   break;
                default: 
                   System.out.println( "Type was: " + 
                      rsmd.getColumnTypeName( i ) );
             System.out.println();
       public void shutDown()
          try {
             connection.close();
          catch ( SQLException sqlex ) {
             System.err.println( "Unable to disconnect->" + sqlex );
       public static void main( String args[] ) 
           int sel = 0;
           Menu M = new Menu();
           Database app = new Database();
           sel = M.mainmenu(sel);
           while (sel > 0 && sel < 5){
           switch (sel){
               case 1: app.connect();
                       app.showTeams();
                       app.shutDown();
                       sel = M.mainmenu(sel);
                       break;
               case 2: app.connect();
                       app.showPlayers();
                       app.shutDown();
                       sel = M.mainmenu(sel);
                       break;
               case 3: app.connect();
                       app.update();
                       app.shutDown();
                       sel = M.mainmenu(sel);
                       break;
    class Menu{ 
        int choice = 0;
        int temp = 0; 
        public Menu(){
        public int mainmenu(int val){ 
            String a = JOptionPane.showInputDialog("TEAM MENU \n\nPlease select an option by entering " + 
                    "the corresponding number: \n\n1. Display Teams \n2. Show Players \n3. Update a Player \n4. Search \n "); 
            val= Integer.parseInt(a); 
            return val; 
        public int setChoice(int val){
            choice = val;
            return choice;

    Well, I'd say a starting point is to split the functionality into "client" and "server". This will wind up as two programs, the client making - remote - requests of the server.
    A fairly natural way would be to assign viewing/display to the client, direct access to the database to the server. So then you have to figure out
    o what kinds of requests can go acrross the divide.
    o what kind of data will be returned.
    This may not be that easy, because things that the server can do easily (like I/O) cnnot be carried back and forth in RMI calls.)

  • I need help with a java assignment

    I am being taught java but dont really understand what i have to do. If you send me an email to [email protected] ill send you a copy and so help me with the assignement.
    I am currently working on free web page so you can download the assignment.
    Thank You All

    hey, there's something wrong with my internet, i clicked on your email adress and nothing happened :(
    too bad. maybe i can't do your assignment.
    go see somee tutorials, maybe these will help you, also try to understand how API will elp you (to both you may find links from left column of this page) and also, see if there area some samples of how to do what you need to be done.
    http://www.javaalmanac.com -- my favorited place for code samples.
    also whan you have some saaignment or other task, then see if google finds you apropriate solution. and there's a search function in these forums as well.
    i hope you get your homework doen in time...

  • 1941w - Need help with IP address assigning, and relay wireless to a DHCP server.

    Hope someone can point me in the right direction -
    Basically have a Win08 R2 DHCP server, and a 1941w router.
    I've got the internet, got the lan clients getting DHCP ok (with ip helper-address set on the 0/0 internal interface).
    Also have the SSID, and wireless clients can connect - but no IPs are being handed out, also not sure if I understand or did the bridging correctly or assigned IPs to the vlan or bvi1 correctly.
    for ex:
    DHCP server IP:
    10.10.2.4
    Router Ethernet internal interface 0/0 IP:
    10.10.2.1
    with helper-address 10.10.2.4 (lan clients are resolving IPs correctly from the DHCP server)
    Vlan1 IP address:
    10.10.3.1
    Does this interface need the helper-address as well? (10.10.2.4)?
    wlan-ap 0 IP address:
    unnumbered
    interface BVI1 IP address (static):
    10.10.2.2
    am i totally off? not even sure if i have the vlan bridged to the 0/0 adapter or not correctly - but as I said, i can get a wireless client to connect with the SSID.
    would appreciate any advice/pointers, thanks

    of course - here is the router config:
    =======================================================
    Using 5591 out of 262136 bytes
    version 15.1
    no service pad
    service tcp-keepalives-in
    service tcp-keepalives-out
    service timestamps debug datetime msec localtime show-timezone
    service timestamps log datetime msec localtime show-timezone
    service password-encryption
    service sequence-numbers
    hostname router
    boot-start-marker
    boot-end-marker
    security authentication failure rate 3 log
    security passwords min-length 6
    logging buffered 51200
    logging console critical
    enable secret 5 $1$JWwK$.04.NFg7tQ82UTy68/hyv.
    no aaa new-model
    service-module wlan-ap 0 bootimage autonomous
    no ipv6 cef
    no ip source-route
    ip cef
    no ip bootp server
    ip name-server 10.10.2.4
    multilink bundle-name authenticated
    crypto pki token default removal timeout 0
    crypto pki trustpoint TP-self-signed-975501586
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-975501586
    revocation-check none
    rsakeypair TP-self-signed-975501586
    crypto pki certificate chain TP-self-signed-975501586
    certificate self-signed 01 nvram:IOS-Self-Sig#3.cer
    license udi pid CISCO1941W-A/K9 sn FTX155085QG
    hw-module ism 0
    ip tcp synwait-time 10
    ip ssh time-out 60
    ip ssh authentication-retries 2
    interface Embedded-Service-Engine0/0
    no ip address
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    shutdown
    interface GigabitEthernet0/0
    description $ETH-LAN$$ETH-SW-LAUNCH$$INTF-INFO-GE 0/0$$ES_LAN$$FW_INSIDE$
    ip address 10.10.2.1 255.255.255.0
    ip helper-address 10.10.2.4
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    ip nat inside
    ip virtual-reassembly in
    duplex auto
    speed auto
    no mop enabled
    interface wlan-ap0
    description Service module interface to manage the embedded AP
    ip unnumbered GigabitEthernet0/0
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    arp timeout 0
    no mop enabled
    no mop sysid
    interface GigabitEthernet0/1
    description $ES_WAN$$FW_OUTSIDE$
    ip address dhcp client-id GigabitEthernet0/1
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    ip nat outside
    ip virtual-reassembly in
    duplex auto
    speed auto
    no mop enabled
    interface Wlan-GigabitEthernet0/0
    description Internal switch interface connecting to the embedded AP
    no ip address
    interface Vlan1
    ip address 10.10.3.1 255.255.255.0
    ip helper-address 10.10.2.4
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    ip forward-protocol nd
    ip http server
    ip http authentication local
    ip http secure-server
    ip http timeout-policy idle 60 life 86400 requests 10000
    ip nat inside source list 1 interface GigabitEthernet0/1 overload
    logging trap debugging
    access-list 1 remark INSIDE_IF=GigabitEthernet0/0
    access-list 1 remark CCP_ACL Category=2
    access-list 1 permit 10.10.2.0 0.0.0.255
    no cdp run
    control-plane
    line con 0
    login local
    transport output telnet
    line aux 0
    login local
    transport output telnet
    line 2
    no activation-character
    no exec
    transport preferred none
    transport input all
    transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
    stopbits 1
    line 67
    no activation-character
    no exec
    transport preferred none
    transport input all
    transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
    line vty 0 4
    privilege level 15
    login local
    transport input telnet ssh
    line vty 5 15
    privilege level 15
    login local
    transport input telnet ssh
    scheduler allocate 20000 1000
    end
    =======================================================
    and the ap config:
    =======================================================
    Using 2067 out of 32768 bytes
    version 12.4
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    service password-encryption
    hostname ap
    enable secret 5 $1$xKDT$GdLGeA6h.H9LKL9l3dPmj.
    no aaa new-model
    dot11 syslog
    dot11 ssid WIFI1
       vlan 1
       authentication open
       authentication key-management wpa
       mbssid guest-mode
       wpa-psk ascii 7 044B1E030D2D43632A
    bridge irb
    interface Dot11Radio0
    no ip address
    no ip route-cache
    encryption vlan 1 mode ciphers aes-ccm
    broadcast-key vlan 1 change 30
    ssid WIFI1
    antenna gain 0
    station-role root
    interface Dot11Radio0.1
    encapsulation dot1Q 1 native
    no ip route-cache
    bridge-group 2
    bridge-group 2 subscriber-loop-control
    bridge-group 2 block-unknown-source
    no bridge-group 2 source-learning
    no bridge-group 2 unicast-flooding
    bridge-group 2 spanning-disabled
    interface Dot11Radio1
    no ip address
    no ip route-cache
    encryption vlan 1 mode ciphers aes-ccm
    broadcast-key vlan 1 change 30
    ssid WIFI1
    antenna gain 0
    dfs band 3 block
    channel dfs
    station-role root
    interface Dot11Radio1.1
    encapsulation dot1Q 1 native
    no ip route-cache
    bridge-group 2
    bridge-group 2 subscriber-loop-control
    bridge-group 2 block-unknown-source
    no bridge-group 2 source-learning
    no bridge-group 2 unicast-flooding
    bridge-group 2 spanning-disabled
    interface GigabitEthernet0
    description  the embedded AP GigabitEthernet 0 is an internal interface connecting AP with the host router
    no ip address
    no ip route-cache
    interface GigabitEthernet0.1
    encapsulation dot1Q 1 native
    no ip route-cache
    bridge-group 1
    no bridge-group 1 source-learning
    bridge-group 1 spanning-disabled
    interface BVI1
    ip address 10.10.2.2 255.255.255.0
    no ip route-cache
    ip http server
    no ip http secure-server
    ip http help-path http://www.cisco.com/warp/public/779/smbiz/prodconfig/help/eag
    bridge 1 route ip
    line con 0
    no activation-character
    line vty 0 4
    login local
    end
    ============================================

  • Help with a java assignment

    I am stuck on some things and I can't find them in my book so here goes. I need to determine if a string is even or odd and then return letters from that word based on which it is.
    I think i need to use a boolean for the even or odd (not for sure) and an if / else statement for the letters, but i am lost on some of the details. I should have to do some math to choose which letters i return, but not for sure on how to setup the math to use on a string.
    can anybody help point me in the right direction with this
    if you need more info on this let me know and i will try to explain it better.
    thanks

    i mean that I need to determine if the number of letters in a word is even or odd.
    and here is the code the first one is my main class. I hope i did that right on the posting of the code
    package wordstester;
    import javax.swing.JOptionPane;
    * @author christopher izatt
    public class WordsTester {
         * @param args the command line arguments
        public static void main(String[] args) {
                  // prompt the user to enter a string of their choice
          String wordChosen;
          wordChosen = JOptionPane.showInputDialog
              ("Please enter a word of your choice here");
          String middlePart;
          middlePart = Words.getMiddle(wordChosen);
          System.out.println("At the middle of " + wordChosen + " is: "
                     + middlePart);
    package wordstester;
    * @author christopher izatt
    public class Words {
          Gets the middle character or character pair from this word
          when possible.
          @param word a word supplied by the method user
          @return the middle character (if the word length is odd) or
          middle two characters (if it is even), or the empty string if
          the word is empty, or null if it is null.
       public static String getMiddle(String word)
        private boolean word;
    }

  • Need Help with my School Assignment - Error Message

    Hey guys,
    I'm doing a school assignment for my Object Oriented Java programing class. Here's the assignment requirements:
    "There are five kinds of flowers, and their associated costs. Create an array of strings that holds the names of these flowers. Create another array that holds the cost of each corresponding flower. Your program should read the name of a flower and the quantity desired by a customer. Locate the flower in the name array and use that index to find the cost per stem in the cost array. Compute and print the total cost of the sale. Write your solution in one class: FlowerCounterArray.
    The solution should implement the following two methods:
    - addOrder(String flowerName, int quantity) to add to the order. This is in addition to reading from the terminal.
    - printTotal() to print out the total cost to the terminal."
    I wrote up some code so far and I want to test it, but I am getting this error: "']' expected" on the newFlower[0] = new FlowerCounterArrays("petunia", 0.50]; line near the end of the code.
    Here's my code:
    public class FlowerCounterArrays {
        private String flowerName;
        private double price;
        public void addOrder(String flowerName, int quantity) {
            for (FlowerCounterArrays flower : newFlower) {
                if (flower.equals(flowerName)) {
                    total = price * quantity;
                    System.out.println("The price for " + quantity + " " + flower + "(s) is " + total);
                else {
                    System.out.println("Unfortunately we do not carry that type of flower here.");
        public void printTotal() {
            System.out.println(total);
        FlowerCounterArrays[] newFlower = new FlowerCounterArrays[5];
        newFlower[0] = new FlowerCounterArrays("petunia", 0.50];
        newFlower[1] = new FlowerCounterArrays("pansy", 0.75);
        newFlower[2] = new FlowerCounterArrays("rose", 1.50);
        newFlower[3] = new FlowerCounterArrays("violet", 0.50);
        newFlower[4] = new FlowerCounterArrays("carnation", 0.80);
    }Thanks for the help guys! Much appreciated!
    Edited by: he4dhuntr on Oct 14, 2008 1:33 PM

    Ok. I'm kind of new to all this, so some stuff I'm not 100% clear on.
    I get what you're saying though. I put the array into the method.
    Although now I get a new errod: "cannot find symbol - constructor FlowerCounterArrays(java.lang.String,double)"
    I get this error on my newFlower[0] = new FlowerCounterArrays("petunia", 0.50); line
    Here's my new code:
    public class FlowerCounterArrays {
        private String flowerName;
        private double price;
        public void addOrder(String flowerName, int quantity) {
            FlowerCounterArrays[] newFlower = new FlowerCounterArrays[5];
            newFlower[0] = new FlowerCounterArrays("petunia", 0.50);
            newFlower[1] = new FlowerCounterArrays("pansy", 0.75);
            newFlower[2] = new FlowerCounterArrays("rose", 1.50);
            newFlower[3] = new FlowerCounterArrays("violet", 0.50);
            newFlower[4] = new FlowerCounterArrays("carnation", 0.80);
            for (FlowerCounterArrays flower : newFlower) {
                if (flower.equals(flowerName)) {
                    total = price * quantity;
                    System.out.println("The price for " + quantity + " " + flower + "(s) is " + total);
                else {
                    System.out.println("Unfortunately we do not carry that type of flower here.");
        public void printTotal() {
            System.out.println(total);
    }Thanks for the help so far!

  • Help with product category assignment please

    Hi experts,
    I need to do a modificacion in my R3 downloaded products to CRM. Because a
    product catalog fulfitment, I need to modify the assigned product hierarchy
    in CRM but I don't know where can I do it this mapping between an R3 product
    hierarchy and CRM product hierarchy.
    I explain, if product A belongs in R3 to product category A, I need to modify
    this assignment in CRM, for exmaple, product A in CRM will belong to product category
    B.
    Modifications/creations on product master are only downloaded to CRM, never upload
    from CRM to R3.
    Any help in this issue please? Is possible to get a behaviour like this?
    Thanks to all.
    Javier

    Hi Javier,
       You can always do a RFC data upload of the changed product from CRM to R/3. I guess you do know how to trigger a OLTP data transfer in product master maintenance transaction COMMPR01.
    Thanks,
    Sudipta.

  • Please Help with RMI Application?

    I'm require to develop an application to simulate system services such as changing passwords and executing remote commands. ie. an application to let the client change a password on a remote machine.
    May problem is i'm very very new to java programming and wouldn't know where to start. If anybody knows of a similar application or can have the source code please please reply me with a copy.
    Thanks

    Well, the place to start is by breaking it down a little bit, and then breaking it down some more, ...
    You need something on the client computer - sounds like some kind of a command-line program, or perhaps a batch script wrapped around a command-line program. You could start by defining your comand-lines.
    You need something on the server host - another program. Needs to do all the things your client program requests, so there are some pretty clear functions to be written.
    The two programs need to communicate. Since you posted to an RMI forum, I guess you want to use RMI. You can either design your server to have one method per client-request type, or - more likely - one remotely callable server routine. You decide, and design your command protocol.
    Then, your server has to do some mechanical things: At startup, register itself with an RMIRegistry.
    Your client, when invoked, will have to get from the user the server host, and look up the server in the registry. Then it will have to make a request and - I guess - just hang waiting for a result.
    Ypou may need user ID and/or password so that your server can authenticate the user.
    Final suggestion: Pick just ONE remote function you would like to implement first, and do the smallest possible implementation just for that function.

  • Please help with the Universal Dock issue!!!

    Hi,
    I recently purchased a universal dock for my iphone 3g. It works great. I just had one question. When my iphone is sitting on it for lets say 20 - 30 minutes. Then if i press the buttons on the remote. nothing happens! If I then press the home button while it is on the cradle then, the remote, it plays music. There after lets say if I stop stop the music through the remote and again press the remote button after a few minutes it starts playing. So what happens after a long time. Why do i have to press the home button on the iphone for the remote to work. Is that how it is supposed to work???
    Thanks,
    Sunil

    Hello! Am i the only one facing this issue?????

  • Help with standard deviation assignment

    I am having trouble with the std deviation portion of one of my assignments. Plus, only 5 test scored will print, not all 6. Could you please take a look and see what I am doing wrong? Is there a way to add the find the std dev. and mean for each semester?
    ----------------------Start Code------------------------------
    public class Main {
        int grades[][]={{15,20,15,20,15,20},
        {14,21,14,21,14,21},{13,22,13,22,13},
        {14,21,14,21,14,21},{15,20,15,20,15}};
        int students, tests;
        String output;
        /** Creates a new instance of Main */
        public Main() {
         * @param args the command line arguments
        public static void main(String[] args) {
            Main m = new Main();
            m.students = m.grades.length;
            m.tests = m.grades[0].length;
            m.output = "The scores are:\n";
            m.buildString();
            m.output += "\nMean:       " + m.mean();
    // +                "\nStd Dev:   " + m.StdDev() + "\n";
            System.out.print(m.output);
        public String mean(){
            double mean = 0;
            String outputMean = "";
            for (int column = 0; column < students; column++){
            int sumOfGrades = 0;
                for (int row = 0; row < students; row++){
                    sumOfGrades += grades[row][column];
                mean = sumOfGrades/students;
                outputMean += mean + "   ";
            return outputMean;
    //    public double StdDev(){
    //        Main m = new Main();
    //        int sumOfGrades = 0;
    //        double StdDev = 0;
    //        for (int column = 0; column < students; column++){
    //            for (int row = 0; row < students; row++){
    //                sumOfGrades += Math.pow((grades[row][column]-mean()), 2);
    //            StdDev = Math.sqrt(mean/students) + "   ";
    //        return StdDev;
        public void buildString(){
            output += "           |       Fall        |       Spring       |\n";
            output += "           ";
            for (int counter = 0; counter < tests; counter++)
                output += "Test " + (counter + 1) + " ";
            for (int row = 0; row < students; row++){
                output += "\nStudent(" + (row + 1)  + ")   ";
                for (int column = 0; column < tests -1; column++)
                    output += grades[row][column] + "     ";
    ----------------------end code-----------------------------
    ------------------ Displays----------------
    The scores are:
               |       Fall        |       Spring       |
               Test 1 Test 2 Test 3 Test 4 Test 5 Test 6
    Student(1)   15     20     15     20     15    
    Student(2)   14     21     14     21     14    
    Student(3)   13     22     13     22     13    
    Student(4)   14     21     14     21     14    
    Student(5)   15     20     15     20     15    
    Mean:       14.0   20.0   14.0   20.0   14.0 
    -----------------end displays----------------

    What I was thinking was that mean() would be a lot more useful if
    (1) you passed it an argument saying what test you were interested in. This would
    take the place of "column" in your code.
    (2) it returned a double value which was the mean of the given test. The snippet you
    posted is OK, except that it should return a double not an int. Ie it should look like:    /** Returns the mean for a given test. */
    public double mean(int column) {
        double mean = 0.0;
        // do calculation
        return mean;
    }Of course if you do this you will have to change how mean() is used from within main().
    Instead of a simple "m.output += "\nMean: " + m.mean();" you will need a loop:    // start the string
    m.output += "\nMean:  ";
    for(int ndx = 0; ndx < tests; ++ndx) {
            // append each mean
        m.output += "  " + mean(ndx);
    }The standard deviation method will be very similar to the mean() one, and
    used in a similar way:    /** Returns the sd for a given test. */
    public double mean(int column) {
        double sd = 0.0;
        // do calculation based on what was posted,
        // or what you have been told to do.
        return sd;
    }

  • Actionscript help with interactive poster

    Hi All,
    I need some desperate help with a university assignment. I can't find any really good tutorials out there, so I was wondering if there were any kind people out there that I could get some on-on one help from?

    If you need one on one guidance for every aspect of the assignment then you probably need to look to your classmates or your instructor. 
    If you can show what you have done so far and what specific aspect you are having a problem with then someone might offer some help.

  • Im DROWNING! need help with a simple java assignment! plz someone help me!

    i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!

    You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
    1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
    2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
    3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
    4. Subtract this sum from the next highest multiple of 10.
    5. The difference should be equal to the 9th digit, which is considered the check digit.
    Example of validating S.I.N. 765932546
    1st digit 7
    2nd digit (6*2 =12 1+2=) 3
    3rd digit 5
    4th digit (9*2 = 18 1+8 =) 9
    5th digit 3
    6th digit (2*2 = 4) 4
    7th digit 5
    8th digit (4*2 = 8) 8
    Total 44 next multiple of 10 is 50
    50-44 = 6 which is the 9th digit
    Therefore the S.I.N. 765932546 is Valid
    ********* SIN Validation *********
    Welcome - Please enter the first number: 120406780
    Second digit value multiplied by 2 4
    Fourth digit value multiplied by 2 8
    Sixth digit value multiplied by 2 12
    Eighth digit value multiplied by 2 16
    Value derived from 6th digit 3
    Value derived from 8th digit 7
    The total is 30
    Calculated digit is 10
    Check digit must be zero because calculated value is 10
    The SIN 120406780 is Valid
    this is my assignemtn this is what i have! i dont know where to start! please help me!
    /*     File:     sinnumber.java
         Author:     Ashley
         Date:     October 2006
         Purpose: Lab1
    import java.util.Scanner;
    public class Lab1
              public static void main(String[] args)
                   Scanner input = new Scanner(System.in);
                   int sin = 0;
                   int number0, number1, number2, number3, number4, number5, number6, number7, number8;
                   int count = 0;
                   int second, fourth, sixth, eighth;
                   System.out.print("\t\n**********************************");
                   System.out.print("\t\n**********SIN Validation**********");
                   System.out.print("\t\n**********************************");
                   System.out.println("\t\nPlease enter the First sin number: ");
                   sin = input.nextInt();
                   count = int.length(sin);     
                   if (count > 8 || count < 8)
                   System.out.print("Valid: ");
         }

Maybe you are looking for

  • Hp Laserjet toolbox not loading

    I have a Laserjet p2015 running on a Mac with os 10.5.8, and I cannot get drivers to include the toolbox, or anything to give me better than standard printing resolution. The printer is supposed to support 1200dpi but the only option I get is 300 or

  • Error 4PRC in Apple Hardware Test

    Hello, I have a 24" iMac (2.16GHz Core Duo, 1.5GB RAM) from late 2006. A few days ago, the display went black although the power stayed on. I turned it off, and it hasn't been able to boot since then. Whether I try to boot normally, in safe mode, or

  • Xserve compatible KVM board like Raritan or alternatives?

    Hi, is there a KVM over IP card like the Raritan eRich G4 that can handle booting from a remote image etc. that works with xserve? The Raritan card is a PCI card but xserve only has PCIe slots, so this won't work. What other options exists as I need

  • HR Technical : Sample program to check if PERNR is changed PART TIME.

    Hi Guys, I will appreciate if somebody can give me the sample program / subroutine to check if a PERNR has been converted from FULL TIME to PART TIME using PERSK. Thanks

  • How to place attribute at column in query designer

    Hi Experts,                  I have to place attribute in column panel, but it is not possible. Is there any solution for this problem. Attribute is already created. please help me to solve this.