Addition In Calculator Application

Hi everyone,
I've got a bit of a problem. I'm busy working on a calculator that will be used in DOS. Eventually it will include the arithmetic operations as well as 5 scientific operations and convert to octal and hexadecimal. I�ve included my code below, it compiles perfectly but now I need to know how to get it to accept numbers that can be stored in an array so that it can for instance add them but then return to the menu to accept the next calculation.
Thanks for any help you may have.
Patrick.
import java.io.*;
import java.util.Date;
import java.text.SimpleDateFormat;
class Calc {
     Calc(String username){
          Date today = new Date();
          SimpleDateFormat time = new SimpleDateFormat("E MMM d yyyy");
          String time2 = time.format(today);
          System.out.println("Welcome " + username + " todays date is " + time2);
          menu();     
     String getInput() {
          String temp = "";
          try {           
               BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
               temp = buff.readLine();
                      } catch (Exception e) {
                         System.out.println("Caught Exception: " + e);
          return temp;
     void menu() {
          String temp = "";
             do{
               System.out.println("\nTo add use +");
               System.out.println("To subtract use -");
               System.out.println("To divide use /");
               System.out.println("To multiply use M");
               temp = getInput();
               if (temp.equals("+") ) {
                    System.out.println("Please enter the numbers you want to add");
                    addition();
          } while (temp.compareToIgnoreCase("exit") != 0);     
     void addition() {
          System.out.println("This is the addition method");
     public static void main(String[] args) {
          if (args.length == 0) {
               System.out.println("Please enter your name and surname at the command prompt...");
               System.exit(0);
          } else {
               Calc Pro = new Calc(args[0]);
}

Can't you do something like this:
try
     int ch;
     while ((ch = System.in.read ()) != '\n')
         // do something here
          System.out.print ((char) ch);
catch (Exception e)
     System.out.println(e);
}

Similar Messages

  • I think I found a problem with the calculator application.

    I'm a south korean highschool student and I think I found a problem with calculator application. I use iPod touch 4th generation with iOS 5.0.1. I was playing with calculator app and I found out that 0.1!(factorial) is 0.951350769866873. This can't be right bacause factorial calculation can only be definrd whan n is natural number or 0(in n!). I want apple to correct this error.
    And if you are someone working with apple, please let me know the algorithm of factorial calculation(if possible). I would be grateful if I can have a chance to study the algorithm and find out what made 0.1! possible.
    so question.
    do anybody know how to send an email to apple? I tried but I couldn't find the address.

    Apple doesn't dialogue with users via email the way you want, but you can report such problems to them via
    http://www.apple.com/feedback/
    But in this particular case you should be aware that factorial can in fact be done for non-integers:
    http://en.wikipedia.org/wiki/Factorial#Extension_of_factorial_to_non-integer_val ues_of_argument

  • Using calculator application without numeric keypad?

    Hello,
    I have a little but very frustrating problem. I was bought a new MacBook in the last week to replace my old PowerBook 12". Everything is fine, I like the new machine but the numeric keypad is missing. This isn't a catastrophic problem, but I can't use the calculator application only using the keyboard! Why? In the calculator application doesn't support the multiplying key (AltShift,) if you are using Hungarian keyboard layout. Any other function is working fine (add, sub, div). With the numeric keypad we can handle this problem, but without it: no!
    So anyone can help me how I can solve this problem?
    Best regards,
    Peter

    I'm not used to Hungarian keyboards but am I right that the multiplying key is the one with the 'Ú' (just googled it)?
    Then you should try to access it with ALT+Ú ... NO shift.
    Maybe this could work. Just give it a try =)
    Edit:
    Hm or it could be the '-' key...
    But I found something interesting on the net:
    http://blog.felho.hu/hungarian-unicode-qwerty-keyboard-layout.html
    It's an apple keyboard there =)
    Message was edited by: Oerle

  • Silencing the HP15c calculator application: anyone know how?

    I have the official Hewlett-Packard 15c calculator application. Does anyone know how to silence it? Everytime I press a key, it is so loud.
    I know that I can hit the side ringer on/off switch, but I want to leave my ringer on. I also know I can put headphones on, but then it clicks through the headphones.
    I've looked in the application settings both inside the application (tilt to landscape, then hit the menu key) as well as in the general iPhone settings area (no HP 15c selection).

    Thanks, Mort, I tried that, but it didn't work...maybe because I was already in the highest resolution?
    I saw advice to someone whose itunes window was too large. They suggested applescript code:
    tell application "Adobe Illustrator"
      set bounds of window 1 to {296, 97, 1394, 996}
    end tell
    I replaced iTunes with illustrator, but got an error message:
    Adobe Illustrator got an error: Can’t set window 1 to {296, 97, 1394, 996}.
    thanks!

  • Calculator application disappeared!

    Hi, i have a 2 mth old nokia 6233.
    I just realised that my calculator application (which I use very often) is missing, can no longer find it under 'menu..organiser..'. It also disappeared from my 'go to' shortcuts. Other applications like alarm clock and stopwatch are still present. Did I accidentally delete it and is it possible to do so? Didn't do anything special on the phone recently other than surfing gprs for soccer results...
    Will a firmware upgrade at a tech support outlet restore the application? Will my msgs and pics disappear?
    Thanks to anyone who can answer my queries...

    I don't have a 6233, but if the calculator app was a Java program, it might very well be uninstallable.
    A firmware update will remove anything in phone memory. Anything on a memory card should be safe (but I'd take it out when leaving a phone to be updated).
    Use, e.g., Nokia PC Suite to back up or copy everything you wish to save to a PC.
    A firmware update should restore the calculator app.
    You can also try to do the update yourself (requires a Windows PC and USB cable):
    http://www.nokia.com/softwareupdate

  • [ OIM 11gR2 PS1 ]How to add additional field on Application Instance Form ?

    Hi,
    In our scenario we have Disconnected applications in OIM. AI (Application Instance) form and PD editing is created by OIM.
    We want to add additional field in AI form.It is visible in back end. But,its not visible in OIM admin console for admin and as well for end user.
    Is there any property related to form field in AI ,where we need to make changes to make it visible ?
    Instance used is OIM 11gR2 PS1
    Thanks,
    RPB
    Edited by: RPB25 on May 29, 2013 9:46 PM

    I was able to resolve this issue . we need to click on "regenerate view".

  • Iphoto is using Calculator application to open photos...help!

    I can import a photo into IPhoto ok but when I click on it to edit it is trying to use the Calculor application to open the photo and it says Calculator can not open that file. How can I fix this?

    Set something else as your External Editor in iPhoto.
    Regards
    TD

  • Error at my calculator application

    this is what I have so far, and i keep getting the errors (which i posted down the bottom, can someone help me out?:
    public class Calculator
    public static void main(String[] args)
    String another = "y";
         while(another.equalsIgnoreCase("y"))
         System.out.println("Enter 1st number: ");
         int number1 = Keyboard.readInt();
         System.out.println("Enter operator (+, -, * or /): ");
         int op = Keyboard.readInt();
         System.out.println("Enter 2nd number: ");
         int number2 = Keyboard.readInt();
    public void makeCalc()
    int result;
         switch(op)
         case '+':
         result = number1 + number2; //Does addition
         break;
         case '-':
         result = number1 - number2; //Does subtraction
         break;
         case '*':
         result = number1 * number2; //Does multiplication
         break;
         case '/':
         result = division; //Sends to private int division
         break;
         default:
         System.out.println("Wrong operator; " + op + "use +, -, *, or / functions");
         int num1 = Keyboard.readInt();
         return(result);
         System.out.println("Another calculation? (y/n) ");
              another = Keyboard.readString();     
    private int division()
         if(number2 == 0) //testing division; does not allow divide by zero
         System.out.println("Error you can not divide by zero");
         another = Keyboard.readString();
         else return(number1/number2);
    and i get the following error:
    Calculator.java:26: illegal start of expression
    public void makeCalc()
    ^
    Calculator.java:71: ';' expected
    ^
    2 errors

    Check your braces {}: you start blocks that you forget to close.
    As you have code after a return statement, you have dead code too.
    /Stephane

  • Installating additional BI Analytics Applications

    Supposing that you have a running Oracle Business Intelligence Applications install with Financial Analytics Applications (7.9.6.1). Thus, the installed module was Financial Analytics and the database schema and the OBIEE RPD were created for Financial Analytics.
    If you need to install HR Analytics into the same database, how do you go about doing it ?
    The Oracle Business Intelligence Applications installation documentation does not seem to explain how to install a new module into an existing environment.
    Hemant K Chitale

    Several things to keep in mind..the SB schema (tables, etc) is not specific to any module..it should install the DB schema and tables for all module (FIN, HR..etc). However, if you only ran the ETLs for Financials Subject Area..then only those tables will be populated. So with regard to DB you should be fine. Second, the DAC can be configured to run additional subject areas. So for instance, if you want to runa HR on top of Financials, you can simply configure the HR subject areas in the DAC and reassemble the subject area and rebuild the execution plan. Also, note that BI Apps has conformed dimensions..which means that tables are shared across subjct areas..so its best to run the loads together. Regarding the RPD, I assume you can "enable" or install the HR objects just like you did for Financials.
    If this is helpful, please mark the respone as correct or helpful.

  • Additional tax calculated in PO

    Dear Friends,
    According to user sales tax rate for PO# 4111131887 should be 9%, however, for last invoice posted agains it, calculated sales tax rate was 13%. User is asking to explain where is the additional tax coming from.
    Please suggest.
    Regards
    Sridhar

    Hi,
    Pleasae check the tax code in the PO and Invoice
    Also check the FTXP for the tax code used.
    Please give complete details.
    Cheers,
    Satish Purandare

  • Lost Calculator application

    Hello,
    I'm brand new to the Apple world (Windows convert) and so far, I've been quite happy. Having fun seeing what I can do, etc. but I have one small problem.
    I put an alias to the calculator on my desktop and it's always worked fine. Today I clicked on it and a dialog box comes up saying "The alias 'Calculator' could not be opened, because the original item cannot be found. I clicked on the box that says "Fix Alias" but it asks "what item do I want the alias to open."
    I've used finder to search for the calulator but it can't find it anywhere on the computer. (I believe it used to be in Applications\Utilities.
    If it's really gone, is there anyway to reinstall it? Any ideas where it could've gone to? (It's not in the trash).
    Mac Mini   Mac OS X (10.3.9)  

    643/3089
    Hi beeker25,
    Welcome to Discussions!
    If it's gone, you should be able to extract it from your install discs using Pacifist,
    but,
    let's first check if you still have it somewhere:
    Restart your Mac from the Panther install DVD (or CD), and run
    Disk Utility > Repair Disk
    (find DU from a menu, just after the first OS reinstall step: do not reinstall OS, obviously).
    A directory Repair with DiskWarrior would be even more efficient.
    This DU or DW repair, in case because of a Directory problem, OS X "thinks" it's gone...
    Oh, and of course when you were looking for it through the alias icon, you tried also "Show Original"?
    Good luck!
    Axl

  • Properly and accurately calculating application cache settings

    Hello everyone.
    We are running Hyperion Planning 11.1.2.1 and one of the dataforms we have set up is quite heavy (it includes several DynamicCalc members with considerable ammount of scripting) and it fails to load from time to time, just saying "Cannot open dataform X. Check logs" and such.
    I have tried to increase cache sizing in the databases of the Essbase application (right clic on each database > edit > properties > caches), as well as buffer sizes and commit blocks.
    Little by little I have managed to improve performance by modifying the above mentioned caches (it crashes less often), but still I guess it's nuts to infinitely increase caches to make sure it works.
    So, my question is: Is there a way to calculate the accurate cache settings for a given application?
    My current settings are:
    Buffer size: 200 KB
    Short buffer size: 200 KB
    Index cache setting: 30720 KB
    Data file cache setting: 61440 KB
    Data cache setting: 51200 KB
    Commit blocks: 30000
    Do you think these are accurate?
    Thanks a lot,
    G.S.Feliu

    You haven't really provided enough information to be honest, for example are you running a 64bit system?
    But that is rhetorical, as usual the first port of call is the DBAG. I don't see why a link should be posted, you must have access to it already if you're administering a production system. That will point out things like that the Data file cache setting is only relevant if Direct I/O is being used and that the index size should be at least as big as the file if memory allows.
    Commit blocks....is interesting, personally I have set it to 0 in some projects and seen some improvement but as usual testing is the key.
    However their is a performance tuning guide out there that you may find very useful:
    https://blogs.oracle.com/pa/entry/epm_11_1_2_epm1
    that focuses on the infrastructure a bit more. Bit complicated though and I would thoroughly recommend recording a set of benchmarks before applying any of those changes, and applying said changes one by one or you'll never know what is good and what is not so good.
    Learn from the pain others have already endured ;-)
    Good Luck
    Steve

  • Application manager insisting I "renew my subscription" but I have a standalone version of acrobat. Any way to convince the manager that my product is registered? There does not seem to be any manual additions in the application manager app.

    I am using Mac OS X (yosemite). I had a creative cloud student subscription for a year (expired in September) and I did not renew. However, I did purchase adobe acrobat XI. I am not sure of the exact day it stopped working (before or after OS upgrade), but now the application manager takes over after I start acrobat and insists I do not have a subscription and must renew. I checked the web and my product is registered and I have the serial number, which I enter upon installation. I've uninstalled and reinstalled everything to no avail. I even contacted adobe and they seemed to have a hard time understanding why I was having a problem since the product was registered. I could not devote much time to the online chat so needless to say, my problem still persists.

    Moving this discussion to the Acrobat Installation & Update issues forum.
    Adugasjr please remove your current installation of Acrobat and reinstall.  If you need a fresh copy of the installation files they are available at Download Acrobat products | Standard, Pro | XI, X.

  • Additional Qty calculation during Ticket creation using function modules

    HI,
    I am trying to create and actualize ticket using FMs in following seuence:
    1) OIJB_TICKET_DEFAULTING
    2) OIJ_EL_A_TICKETS_MAINTAIN_N
    3) OIJB_GENERATE_DOCUMENTS_N
    I am passing OIJ_EL_TKT_I_O1 details to FM OIJB_TICKET_DEFAULTING.
    Requiement is based on OIJ_EL_TKT_I_O1, it should calculate additional quantities OIJ_EL_TKT_I_O2.
    But it seems it is not populating OIJ_EL_TKT_I_O2.
    Any Idea why FM does not calculate OIJ_EL_TKT_I_O2? Or do we need to calculate externally and then Pass it to FM? Which FM does this?
    Thanks & Regards,
    Umesh

    Hi Umesh,
      The function module OIJB_TICKET_DEFAULTING should do the conversion based on the parameters you pass via OIJ_EL_TKT_I_O1.
    It will do this only if the parameter ET_TICKET_ITEM_O2 is requested.
    Check if you are properly passing an internal table in this field.
    Best Regards
    Vishnu

  • I keep getting message "Your MacOs X start-up disk has no additional room for application memory"

    I continue receiving the following message on both my iMac and MacBookPro:  "Your Mac OS X startup disk has no more space available for application memory. To avoid problems with your computer, quit any applications you are not using." I started getting these messages, on both computers, during the same week.
    I have over 500 GB free space on my iMac HD and 4 GB RAM. On my MBP, I have 472 GB  free on my hard disk and 8 MB RAM. BOth are running Mac OS X 10.6.8.
    Any ideas what is going wrong here?

    By way of further explanation, your computers each sometimes require the use of Virtual Memory whenever the RAM is fully in use.  The Virtual Memory is actually unused space on your harddrive where the computer temporarily store data since the RAM is full.  To be effective, your harddrive, or more correctly, the partition that OSX is installed on should have at least 15% Free Space to be used as Virtual Memory.
    If you have multiple partitions on your harddrive, it is possible that the partition that OSX is on is too small in storage capacity and so you lack adequate Free Space on that partition to be used as Virtual Memory. Thus you get the Warning Message.

Maybe you are looking for

  • New updates excludes me from opening Wimba audio posts

    I would go onto Drexel U. website and listen to audio posts from students through Wimba. Updated MacBook Pro last evening and now cannot access Wimba site. I can, however, access Wimba after I restart the computer. But, I need to restart every time t

  • Interface not running: ORA-01722: invalid number

    Hi, I have migrated my ODI master&work repositories from my development-machine to my local laptop and now I get this error when executing one of my Interfaces: ORA-01722 Invalid number (I translated this because I get this error in Dutch!!). On my d

  • Interest in building a creative firmware commun

    I bought myself a muvo Micro n200 a little while ago. Great little player - I'm really enjoying it. However, I've found a number of small things (mostly with the interface, but some H/W) that irk me. Looking at the forums - it looks like lot's of oth

  • 10.3.9 upgrade causes Repair Disk Permission problem...

    I just upgraded my OS from 10.3.5 to 10.3.9 Before I upgraded, I quit all applications and I repaired my Disk Permissions. I then installed the OS 10.3.9 combined upgrade from my Software Update and after it was finished, I restarted. All went well a

  • Upgraded to iPhoto 08 this morning now iWeb is completely messed up

    My templates are gone - all of the pictures!!!!! I open a page it has no templates at all and I get an error saying that the page is missing files that are the background and headers. All of my pictures are now envelopes as place holders. What do I d