horace's Profile User Rating: *****

Reputation: 414 Architect
Group:
Expert
Active Posts:
2,350 (0.73 per day)
Joined:
25-October 06
Profile Views:
10,693
Last Active:
User is online 2 minutes ago
Currently:
Viewing Forum: C and C++

Previous Fields

Country:
GB
OS Preference:
Linux
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
50

Latest Visitors

Icon   horace has not set their status

Posts I've Made

  1. In Topic: Running A TcpServer That Can Handle Multiple Request

    Posted 1 Sep 2015

    you need to use seperate threads of control to handle each client connection
    https://support.micr...en-us/kb/315577

    there are number of examples of multithreaded TCP servers on the web, e.g.
    http://www.codeproje...nd-server-class
    http://vb.net-inform...programming.htm
  2. In Topic: Loop and Switch conflict?

    Posted 31 Aug 2015

    move the test for even/off inside the for() loop
    try removing the } on line 53 and adding one on line 60, e.g.
      // }   removed
    
        if (a % 2 == 0)
        cout << "even" << endl;
    
        else
        cout << "odd" << endl;
    }  // added
    
    

    a run then gives
    8
    11
    eight
    even
    nine
    odd
    
    Process returned 0 (0x0)   execution time : 3.053 s
    Press any key to continue.
    
    

    is that what you required?
  3. In Topic: If else Statement help

    Posted 31 Aug 2015

    if I run
     public void enterButtonclicked() {
    
           Installation installation = new Installation();
           installation.setCustomerName(nameInput.getText());
           installation.setHouseNumber(Double.parseDouble(houseInput.getText()));
           installation.setStreetName(streetInput.getText());
           installation.setTown(townInput.getText());
           installation.setNumOutlets(Integer.parseInt(outletInput.getText()));
           installation.setNumZones(Integer.parseInt(zoneInput.getText()));
           installation.setDate(dateInput.getText());
           
           int numZones = (int) installation.getNumZones();
           int numOutlets = (int) installation.getNumOutlets();
           String installationType = installation.getInstallationType();
    
           System.out.println(" numOutlets " + numOutlets + " numZones " + numZones);
    
    
           if(numOutlets > 2 || numZones > 4){
               installationType = "Standard Installation";
               System.out.println( "Standard Installation");
           }else{
               installationType = "Custom Installation";
               System.out.println( "custom Installation");
           }
    
           installationTable.getItems().add(installation);
           nameInput.clear();
           houseInput.clear();
           streetInput.clear();
           townInput.clear();
           outletInput.clear();
           zoneInput.clear();
           dateInput.clear();
       }
    

    and enter data I get
     numOutlets 2 numZones 3
    custom Installation
     numOutlets 6 numZones 7
    Standard Installation
    
    

    it displays the values I entered for numOutlets and numZones and the if() appears to be working
    not sure what your problem is?

    just realized that you are not saving the installationType
           if(numOutlets > 2 || numZones > 4){
               installationType = "Standard Installation";
               System.out.println( "Standard Installation");
           }else{
               installationType = "Custom Installation";
               System.out.println( "custom Installation");
           }
           installation.setInstallationType(installationType);    // << missing
           installationTable.getItems().add(installation);
    
    

    it then appears in your GUI
  4. In Topic: If else Statement help

    Posted 31 Aug 2015

    the statement
    System.out.println(numOutlets + numZones);
    

    would print the sum of the two integers
    try
    System.out.println(numOutlets + " " +  numZones);
    
  5. In Topic: If else Statement help

    Posted 31 Aug 2015

    does the code compile, I get error messages
    c:\temp\Main.java:202: error: cannot find symbol
            if(numOutlets > 2 || numZones > 4){
               ^
      symbol:   variable numOutlets
      location: class Main
    c:\temp\Main.java:202: error: cannot find symbol
            if(numOutlets > 2 || numZones > 4){
                                 ^
      symbol:   variable numZones
    
    

    do you need to get the values from the Installation class?

    otherwise the if() statement looks Ok - could you put a println() statement in enterButtonclicked() to print out the values of numOutlets and numZones to check they are what you expect

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Norwich UK
Interests:
C/C++ including embedded code for dsPIC, PIC24, PIC32 and TMS320C6711
C#, VB.NET, Java
client/server applications using TCP, UDP, RMI, etc
Computer hardware, microcontrollers, interfacing, e.g. I2C, SPI, CANBUS, etc
Years Programming:
30
Programming Languages:
C,C++,Java,C#,VB.NET

Contact Information

E-mail:
Private
Website URL:
Website URL  http://

Comments

Page 1 of 1
  1. Photo

    R@HUL Icon

    18 Jul 2015 - 00:13
    hey can you check your inbox please...
  2. Photo

    roosh.t3 Icon

    19 Jun 2015 - 23:42
    Hey, I need a help in C++, if you're willing to give a help :)
  3. Photo

    macosxnerd101 Icon

    31 May 2015 - 21:22
    Welcome back, horace! It's great to see you around DIC again. :-)
Page 1 of 1