What comes out?
int a=7, b = 6, c = 2;
1. if (a < 5)
System.out.print("Joe");
else
System.out.print( "Sue");
2. if (a > 4)
System.out.print( "Mike");
if (a < 8)
System.out.print("Tom");
3. if (a >4)
System.out.print( "Mike");
else
System.out.print( "Fred");
4. if (b % 2 ==0)
System.out.print( "Even");
else
System.out.print( "Odd");
5. if ( b <= c)
System.out.print( b+c);
else
System.out.print(b-c);
6. if (c % 2 == 0)
System.out.print( "Joe");
System.out.print( "Tom");
7. if (c % 2==1)
System.out.print( "Joe");
System.out.print( "Tom");
8. if (a < c)
System.out.print( "Tom");
if (c < a)
System.out.print( "Mike");
9. if (a + b < c)
System.out.print( "Tom");
else
System.out.print( "Mary");
10. if ( c > b)
System.out.print(a + b * c);
else
System.out.print( c + b * a);
11. if (a% 2==0 && b % 2 == 0)
System.out.print( "Sue");
else
System.out.print( "Fred");
12. if (a > 3 || b > 2)
System.out.print( "helen");
else
System.out.print("Joe");
13. if (a > 12 || b > 7 || c > 1)
System.out.print( "Central");
else
System.out.print( "High");
14. if (a % b ==1 || c > 6)
System.out.print( "Joe");
System.out.print( "Tom");
15. if (b != 6 && c != 2)
System.out.print( "Fred");
else
System.out.print( "Mike");
16. if (b >3)
{System.out.print( "Tom");
System.out.print( "Joe");
}
else
System.out.print("Mike");
17. if ( a > b || a > c)
System.out.print( "Pete");
else
System.out.print( "Nancy");
18. if (a > b && a > c)
System.out.print( "Helen");
else
{System.out.print( "Debbie");
System.out.print("George");
}
19. if (a > 8 || a < 8)
System.out.print( "Tom");
if (a > 8 && a < 8)
System.out.print( "Pete");
20. if ( c > b || c > a)
System.out.print( "Tom");
if ( c < 4)
System.out.print( "Mike");
System.out.print( "Fred");
21. Write a program that will let you enter a number and will then tell you whether the number is odd or even.
22. Write a program that will let you enter 2 numbers and will then tell you which one was the smallest.
23. Write a program that will let you enter your age and will then tell you if you are old enough to vote.
24. Write a program that will let you enter 2 numbers and then a character (M, D, A or S) and will then give you the product, quotient, sum or difference.
25. Write a program that will let you enter a number and will then tell you whether the number was positive or negative.
26. Write a program that will let you enter your age and will then tell you whether you are young, middle aged or old.
27. Write a program that will let you enter 3 prices and will then figure out your discount and tell you the total cost. Discount rate is 10% if you spent over $100 , 5% if you spent less.
28. Write a program that will let you enter how many hours you worked and then a character to say if you are male or female and will then tell you how much you made for the week. (Females make $6.78 an hour, males $5.87)
29. Enter 3 numbers and print out the smallest.
30. Enter how many inches tall you and then print out short, medium or tall.
31. Enter 3 grades and then print out a message that you made honors or didn't make honors.
32. Enter 3 grades and print a message if you passed all 3 tests or didn't pass all 3 tests.
33. Enter 3 numbers and print out all the numbers are the same, 2 of the numbers are the same or none of the numbers are the same.
34. Write a program that will let you enter a name and will then print out the phone number for that person. It should work for 3 people. If the person entered is not one of the 3 people then print a message that that person is not on file.
35. Enter 3 sides of a triangle and print out scalene, isosceles or equilateral.