Dankwansere's Profile User Rating: -----

Reputation: 67 Whiz
Group:
Active Members
Active Posts:
209 (0.11 per day)
Joined:
09-November 09
Profile Views:
6,134
Last Active:
User is offline Today, 07:35 AM
Currently:
Offline

Previous Fields

Country:
CA
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Infiniti
Dream Kudos:
0

Latest Visitors

Icon   Dankwansere has not set their status

Posts I've Made

  1. In Topic: How can i delimit the spaces in user input separating two data types?

    Posted 17 Jan 2015

    View Postbrerallia, on 17 January 2015 - 10:17 AM, said:

    I am creating a calculator in which a user will directly input the numbers and the operator...

    Here is my code:
    int answer = 0;
    	    int num1, num2;
    	    char operator;
    
    		System.out.print("Enter calculation: ");
    		num1 = kb.nextInt();
    		operator = kb.next().charAt(0);
    		num2 = kb.nextInt();
    



    The code above will accept the user input when there are spaces like this:
    1 + 1
    so the program will give an answer which is 2...BUT
    if i input 1+1 it will give an error...Exception in thread "main" java.util.InputMismatchException


    How are you implementing the "add" logic, there are many ways you could go about this. You can have a simple if function that checks the char variable to see whether its a " + - * or /" depending on what operator it is, you can call the required method.
    eg.
         num1 = kb.nextInt();
         operator = kb.next().charAt(0);
         num2 = kb.nextInt();
    


    if(operator == '+')
    {
    result = add(num1, num2);
    System.out.println(result)
    }

    public static int add(int num, int num2)
    {
    int num3 = num + num2;

    return num3;
    }



    [/code]
  2. In Topic: MS Excel interop in c#

    Posted 11 Jan 2015

    Use must reference the office interop libraries in your project before you can use it.
  3. In Topic: Trying to access word file from aspx site running on IIS

    Posted 12 Dec 2014

    From the reading the link you provided, I can understand why i'm facing these errors. But what i'm still confused about is that the same application is running on a windows 2003 server, with office 2007 installed and its able to access word documents through asmx pages.
  4. In Topic: I'm getting this error code

    Posted 7 Sep 2014

    The setradius(double radi) method requires an argument of "double" type. so you have to have a an argument when you're calling that setradius method. for example circle1 = inputCircle.setradius(22.4);
  5. In Topic: Number Guessing Program

    Posted 6 Sep 2014

    I agree with macosxnerd101, you could easily read the input as strings and then use the strings equal method to do the comparison. But if you insist on using your logic, you can easily debug it by initializing the lottery variable yourself. Say give it a number of 987. Then when you run the program input the same number and see if the logic runs correctly. So far I tried it 987 = 987 and received the correct output. also tried 987 = 985 and received the correct output which was - Match one digit: You win $1,000

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
6
Programming Languages:
Java, C#, C, Unix, HTML, Xhtml, PHP

Contact Information

E-mail:
Click here to e-mail me
Facebook:
http://www.facebook.com/profile.php?id=509694751

Friends

Comments

Dankwansere has no profile comments yet. Why not say hello?