User Profile

Collapse

Profile Sidebar

Collapse
Max347
Max347
Last Activity: Feb 13 '08, 12:56 PM
Joined: Feb 13 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • PROBLEM SOLVED! You are the master, thank you so much for all your help! Max...
    See more | Go to post

    Leave a comment:


  • Ok, sorry about the code. I took out the loop. What if I just put one output on the bottom? null? When I compile this, it goes through now, asks me for my info, but then doesnt output. Here is what I have-
    Code:
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class Calculator{
    public static void main (String[] args) {
    String inputString = JOptionPane.showInputDialog("Input...etc etc");
    ...
    See more | Go to post

    Leave a comment:


  • Yeah, I know I do. Im downloading it right now (thanks for the link btw). Here's what I have-

    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    public class Calculator{
    public static void main (String[] args) {
    String inputString = JOptionPane.sho wInputDialog("I nput...etc etc");
    String[] result = inputString.spl it("//s");
    for (int x=0; x<result.length ;...
    See more | Go to post

    Leave a comment:


  • What about floats? how about this-
    This is what ive got-

    Float.parseFloa t(result[0]) = n1;
    Float.parseFloa t(result[2]) = n2;
    switch (1)
    {
    case '+':
    JOptionPane.sho wMessageDialog( inputString + " = " + n1 + n2);


    Will that output 2 + 1 = 3? (I cant run it yet) Thanks...
    See more | Go to post

    Leave a comment:


  • Ok, ive been experimenting, and took out the whole String a, String b business, I guess they dont need to specifically be defined. I now still have the "illegal start of expression on the colons in my cases. Am I missing something? Thanks
    See more | Go to post

    Leave a comment:


  • Alright cool, thats exactly what I was looking for.
    Ok, I put in the String a = a, etc, however it says it is not a statement.

    String a = result[0];
    String b = result[1];
    String c = result[2];
    switch (b)
    {
    case +:
    case -:
    case /:
    case *:

    I know I need to fill in each possible case, but is it right? The complier is telling me I can't do the...
    See more | Go to post

    Leave a comment:


  • Oh alright, I gotcha on the outputs. As for the splits, how do I actually use them? Will the result change throughout the code as I use it for different things? What im asking, is can I name them or something? Thanks
    See more | Go to post

    Leave a comment:


  • My requirements limit me to the one output, would this be easier to tokenize, and make tokens? Thanks!...
    See more | Go to post

    Leave a comment:


  • Also, ive found references to arrays, so maybe thats my solution? If someone has a guide?
    Thanks
    See more | Go to post

    Leave a comment:


  • Max347
    started a topic Need help with Split String to create a calculator
    in Java

    Need help with Split String to create a calculator

    This is my first post, so hopefully I can give enough information. I am running windows xp, using jGrasp to write code. I need to make a calculator in which the user inputs 2 floating point numbers and an operation, with and output of the answer with the original equation. I think I need to use the split function, however I dont know what to do once it is split. Here is what I have so far-

    import javax.swing.*;
    import java.awt.*;...
    See more | Go to post
No activity results to display
Show More
Working...