CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2011
    Posts
    5

    need help with my flowchart (java)

    The java program i have to come out with for a mini project is a interest calculator, using jcreator. Where you have to calculate the following
    1. interest payable
    2. principle required to earn $x of interest
    3. calculate time required to earn $x of interest.

    The program must cycle continuously until the user selects choice 4 to stop it. However, the program must be able to display all the entries before exiting using arrays. ie(just random numbers):

    principle($)---Rate(%)-----Days----Interest($)----Total($)
    40000.00--------2.32--------100-----600.36-------42000.985
    20000.00--------2.50--------200-----500.00-------23520.00 ..etc etc

    Here is the basic flowchart i created. I have got no idea how to implement arrays into a flowchart, i tried looking up samples online but i couldn't understand it!! The question says that the minimum array size is 10.
    Must methods/main() be used? If so, how do i integrate them into the existing flowchart?
    The actual code is still unnecessary at this point, until the flowchart has been approved.

    http://oi55.tinypic.com/28vsqwy.jpg

    Thanks in advance

  2. #2
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: need help with my flowchart (java)

    Quote Originally Posted by hoven View Post
    Must methods/main() be used?
    Java Tutorial

  3. #3
    Join Date
    Jan 2011
    Location
    Tacoma, Washington
    Posts
    31

    Re: need help with my flowchart (java)

    If this is a general flowchart then I don't think you are going to get a lot of answers here, as this is a coding forum. Sure, flowcharts can be a tool to programming, however, they are a subject in and of themselves.

    About Java and the requirements to create a program from your flowchart.

    The program must cycle continuously until the user selects choice 4 to stop it.
    This sounds like procedural coding (like plain old C) where the program runs line by line from beginning to end, unless otherwise directed by the program. Your flowchart seems to follow the same logic. This is not really necessary in an Object Oriented Program (OOP) like Java. You would create buttons or key bindings for the options and when the user actives one of the options via a button click or an appropriate key stroke an action will be preformed. Once the action is done then the program waits indefinitely until a client makes another selection (including quit/exit).

    The question says that the minimum array size is 10.
    This seems to be an odd requirement for an array. Arrays generally have a set number for maximum elements. So an array with 10 elements can have from No Elements to 10 elements. To have an array that has a "minimum" size means you will need to create a large array and make sure that there are always at least 10 elements in it (but not more than maximum). Either that or you have to make some methods to grow/shrink the array based on the number of elements it has. But by that point you would generally use a collection (i.e. a List<Object> of some Type) that takes care of that stuff automatically.

    However, the program must be able to display all the entries before exiting using arrays. ie(just random numbers):

    principle($)---Rate(%)-----Days----Interest($)----Total($)
    40000.00--------2.32--------100-----600.36-------42000.985
    20000.00--------2.50--------200-----500.00-------23520.00 ..etc etc
    If you are creating data and storing it arrays (or collections as noted above) then you can have the program continually display the data stored as it updates or, upon detecting a closing event, can have the program display all of the information.

    Looks like you know how to make a flowchart so if you just don't know the first step to turning a flowchart into a Java program then you should consider a general Java tutorial as Martin O has stated above.

    If you have some more specific (even basic stuff if you didn't catch it in a tutorial) coding questions then toss those up here and we'll take a stab at them.

    BTW. This project seems to have some odd requirements so it seems to be a question about a homework assignment. While it is not forbidden to ask/answer questions about homework it is generally expected that you handle a homework question in a specific fashion.

    Anyway,
    Good Luck. =D

  4. #4
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: need help with my flowchart (java)

    Quote Originally Posted by djgarrison View Post
    This sounds like procedural coding (like plain old C) where the program runs line by line from beginning to end, unless otherwise directed by the program.
    No, it's a console based program (http://en.wikipedia.org/wiki/Console_application). The type of user interface a program has, whether it's console vs graphical, is not related to procedural vs OO programming. You can use OOP to write a console program and you can use procedural programming to write a GUI with buttons.

    Quote Originally Posted by djgarrison View Post
    This is not really necessary in an Object Oriented Program (OOP) like Java
    The more correct term would be 'object oriented programming *language*'
    Its not a question of whether its necessary or not, its what is appropriate. If the program will be run by a user then a GUI program *may* be better than a console (character-based) program. If it will be run in the background, then console based is most likely the better option. And if the user is just starting out with Java programming then he should definitely stay away from GUI's until he has a basic understanding of the language. If you don't know whether your program will 'need methods' then you need to start from page 1 of whatever book or tutorial you are using to learn Java. BTW, the tutorial I linked is excellent, except for some reason they start you off using Netbeans. IMO someone new to Java should avoid IDE's like Netbeans or Eclipse until they have the fundamentals down.

    BTW, Some examples of console based programs are:
    telnet, scp, ssh, rsync, svn
    There may be versions of these programs with a GUI, but they're probably named differently (WinSCP, TortoiseSVN for example).

    Another example is the JDK installer. The Windows version is a GUI program, the Linux version is a console application.

  5. #5
    Join Date
    Jan 2011
    Location
    Tacoma, Washington
    Posts
    31

    Re: need help with my flowchart (java)

    Quite right. I guess I overlooked that. I have been groomed in college to migrate from console applications to gui applications. Often forgetting that there are many ways to accomplish a goal.

    I agree about the IDE. I think a good understanding of the basic syntax and structure of the language is important. A beginning student should be able to write a simple program in a text editor. Much can be learned in such a way.


    Thanks for the clarifications. =D

  6. #6
    Join Date
    Jan 2011
    Posts
    5

    Re: need help with my flowchart (java)

    alright thanks for the input. I'll start writing the codes after i have my flowchart has been approved, if anything goes wrong and i can't figure it out, i'll try asking for help here.
    Thanks Martin O for the link.

  7. #7
    Join Date
    Jan 2011
    Posts
    5

    Re: need help with my flowchart (java)

    alright thanks for the input. I'll start writing the codes after i have my flowchart approved, if anything goes wrong and i can't figure it out, i'll try asking for help here.
    Thanks Martin O for the link.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured