Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: Decision making statements

  1. #1
    Junior Member
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Decision making statements

    Hello,

    I want to check how many of the following statements are true? But I should do this without "decision making statements".

    x>=0
    x>y
    x !=0


    Thanks

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Decision making statements

    want to check ... without "decision making statements".
    Can you write some pseudo code that would should what you want to do?
    What are "decision making statements" that you need to skip?

    If a "check" is supposed to return true or false, how can that be done without making a decision?
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    shervan360 (December 25th, 2020)

  4. #3
    Junior Member
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Re: Decision making statements

    Quote Originally Posted by Norm View Post
    Can you write some pseudo code that would should what you want to do?
    What are "decision making statements" that you need to skip?

    If a "check" is supposed to return true or false, how can that be done without making a decision?
    Thank you,

    Decision Making in Java are if , if..else, Nested if, if-else-if , switch

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Decision making statements

    If a "check" is supposed to return true or false, how can that be done without making a decision?
    Are only the if and switch statements forbidden? What about the ternary statement?
    Did the instructor give any hints?
    If you don't understand my answer, don't ignore it, ask a question.

  6. The Following User Says Thank You to Norm For This Useful Post:

    shervan360 (December 25th, 2020)

  7. #5
    Junior Member
    Join Date
    Nov 2019
    Posts
    22
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Re: Decision making statements

    Quote Originally Posted by Norm View Post
    Are only the if and switch statements forbidden? What about the ternary statement?
    Did the instructor give any hints?
    I don't have any hints.

    Write a program that receives two numbers X and Y from the input. without decision making determine how many of the following statements are true?

    x>=0
    x>y
    x !=0

    --- Update ---

    Is this a good idea?

    int x, y;
     
    	boolean first = ( x >= 0);
    	boolean second = (x>= y);

  8. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Decision making statements

    Have you tried it? What happened?

    The problem statement says: how many of the following statements are true?
    I assume that means the answer will be a number. For example: 4 statements are true.
    How do you count the number of true values?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. GUI design decision
    By FaisalBahadur in forum AWT / Java Swing
    Replies: 2
    Last Post: June 7th, 2014, 03:38 PM
  2. technology decision
    By suna in forum JDBC & Databases
    Replies: 1
    Last Post: April 28th, 2014, 03:22 PM
  3. [SOLVED] Decision Making Exercise
    By Wooth in forum What's Wrong With My Code?
    Replies: 8
    Last Post: January 26th, 2014, 05:14 PM
  4. Alternate Decision Process Needed
    By brooksr13 in forum Algorithms & Recursion
    Replies: 3
    Last Post: October 12th, 2013, 04:27 AM
  5. Ordered Binary Decision Tree
    By nilay in forum Member Introductions
    Replies: 1
    Last Post: October 7th, 2011, 06:12 AM