Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Cdwgmny

write a short program to find the oldest person between you and one other individual. Use a flow control statement to print the outcome of the result.

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. Narsat
    Best Response
    You've already chosen the best response.
    Medals 2

    What language do you need to use? The simplest way to do this is with an if-else statement if( /*<condition>*/ ) { //print .... } else { //print .... }

    • 2 years ago
  2. Cdwgmny
    Best Response
    You've already chosen the best response.
    Medals 0

    I believe that it is supposed to be switch.

    • 2 years ago
  3. Narsat
    Best Response
    You've already chosen the best response.
    Medals 2

    http://en.wikipedia.org/wiki/Control_flow -- All of the general flow control statements for most programming languages. A switch is not viable since you have two values Age1 and Age2, there's you wouldn't be able to compare both of those inside a switch, unless your programming language lets you do an evaluation inside a switch, though I don't think it's possible. Switches are for specific values on a single variable, let's say you expect age to be between 1-100 switch(Age1){ case 1: case 2: case 3: System.out.println("Toddler"); break; case 4: .... case 12: System.out.println("Kid"); break; case 13: ... case 18: System.out.println("Adolescent"); break; ...etc } Flow control for comparisons between two variables will usually be if-else

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.