Jump to content

  • Log In with Google      Sign In   
  • Create Account


Subtle_Wonders

Member Since 10 Feb 2013
Offline Last Active Feb 17 2014 09:29 AM
*----

Topics I've Started

Java Android Application Direction Requested...

01 January 2014 - 11:44 PM

Hello everyone. Thank you for taking the time and interest in reading this thread. I've broken down the opening topic of this thread for easier reading. Before I get started, let me give you a very brief background about myself.

 

About me:

I'm a Java Application Developer. I focus primarily on the business logic of a multitier (client-server) architecture:

 

http://en.wikipedia.org/wiki/Multitier_architecture

http://en.wikipedia.org/wiki/Business_logic

 

 

About what I'm doing which is related to this thread:

I'm gearing up to make a cross platform Instant Messenger Client & Server. This is purely for educational reasons. I am confident I have what I need to commit myself for this project on a Windows/Linux/Mac environment.

 

 

Where I could use your help:

I would like (preferably from someone who's already done it) to give me an idea of what I will need to successfully create a client to server application on an Android mobile device. There are some requirements, so in finer clarity:

  1. The APIs must be scalable with JOGL for later projects.
  2. The APIs must be easily integrated with Eclipse IDE (no Netbeans IDE please).
  3. I want to avoid Game Engines like jMonkey as these remove the education value of what I'm aiming for.
  4. I would like something that's standard for businesses, like Java ME for starters.
  5. I need to know the business model just like mine listed above for multitier architecture.

 

Conclusion:

If anyone could answer these questions, you would be doing me a great service, and saving me hours if not days of doing the research myself. If I'm going to recreate the wheal, I really want to confine it in the development, and not the designing aspect of SDLC. Many thanks in advance.

 

Oh, and please... while I have respect for other languages, please do not make comments about using a different language. Thank you!smile.png

 

 

NOTE: I am not in any rush for an answer. With that said, if someone is trying to research the design aspect of this request, and than implement it to verify and for their own learning before answering this inquiry, than kudos to you.  biggrin.png


Looking for ways to improve code...

14 February 2013 - 02:59 AM

//*******************************************************************
// File:   CIT245_CJepson_Assignment_2a.cpp
// Author: cjepson
// Created on February 7, 2013, 6:49 PM
// Language: C++
// IDE: Netbeans IDE 7.2.1
// Compiler: /usr/include/c++/4.7/x86_64-linux-gnu
// Class: CIT245-BIN1 Data Structures and Programming C++
// Assignment: Assignment_2a
//*******************************************************************

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

// Used for system() function, to allow easy and bug free translation between OS.
#define WINDOWS 0
#define LINUX 1
#define SYSTEMOUTPUT WINDOWS //WINDOWS = cmd: pause / LINUX = cmd: sleep 1

int main() {
    // Console commands between Linux/Windows differ, pause will not work on Linux
    // This code identifies which OS is current in use, executes appropriate console command.
#if SYSTEMOUTPUT == WINDOWS
    int sysOut = 0;
#define CHOSEN WINDOWS
#else
    int sysOut = 1;
#define CHOSEN LINUX
#endif
    // *** End of C++ Preprocessor Directives ***  

    int y = 0;
    bool x = false;
    //*** DECLARE VARIABLES HERE ***
    int userInput;
    int randResults;
    int sum[12] = {0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
    int sumRolled[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0};
    int odds[12] = {10, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2 ,1};
    int digits = 0;
    double errors[12] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
    srand(12);
    //*** END OF VARIABLE DECLARATION ***
    
    do {
        //*** ENTER CODE HERE ***

        // Recieve user input
        cout << "Enter an integer value: ";
        cin >> userInput;
        cout << endl;        
        
        // Generate numbers user input number of times
        for(int count = 0, cnt = 0; count <= userInput; count++, cnt++){
            randResults = (rand( ) % 6 ) + (rand( ) % 6) + 1;
            sumRolled[randResults]++;
          }
        
        // Acquire number of integers user inputed (e.g., 248 = 3).
        sum[0] = userInput;
        while (sum[0] != 0) { 
            sum[0] /= 10; 
            digits++; 
        }

        // Recreate number based on integers keyed in.
        // *** Critical for calculating the odds length.
        sum[0] = 
        (digits == 1 ? 1 :
        (digits == 2 ? 1 :
        (digits == 3 ? 10 :
        (digits == 4 ? 100 :
        (digits == 5 ? 1000 :
        (digits == 6 ? 10000 :
        100000))))));

        // Text output and formatting   
        cout << "Sum\t  #Rolled\tOdds\t%Error" << endl;
        cout.precision(4); // Floating point precision
        cout.setf(ios::fixed,ios::floatfield); // Aligns decimal point
        
        for(int count = 1; count < 12; count++){
            cout << setw(2) << right << sum[count] << ":\t";
            cout << setw(9) << right << sumRolled[count] << setw(11) << right 
                    << odds[count] * sum[0] << setw(11) << right 
                    << abs(((float)sumRolled[count] / (float)(odds[count] * sum[0]) * 100) - 100)
                    << endl;
        }

        // Resetting variable values for loop
        userInput = 0;
        randResults = 0;
        digits = 0;
        sum[0] = 0;
        
        for(int count = 0; count < 12; count++){
            sumRolled[count] = 0;
            errors[count] = 0.0;
        }

        
        //*** END CODE HERE ***
        do {
            cout << "Do you wish to continue? (1 = yes / 0 = no): ";
            cin >> y;
            if (y == 0) {
                x = true;
            } else if (y > 1) {
                cout << "Please try again!\n";
            }
        } while (y > 1);
    } while (x == false);

    // Requires the C++ Preprocessor Directives
    if (sysOut == 0) {
        system("pause");
    } else if (sysOut == 1) {
        system("sleep 1");
    }
    return 0;
} // End of main()


Since I haven't been accepted to any hobbiest projects yet, I figured I'll learn something new here while I wait for someone to accept me.  Anyone want to hit this code for ways of improving performance (w/o elliminating features & functionality)?  The code is in C++.


PARTNERS