touque.ca > Education Commons > Java > Assignments > Selection

Selection

  1. A PrimeInteger class that determines whether an integer is prime (divisible only by itself and 1). Hint: use two nested loops and the modulus operator.
  2. An IB_Grade class that determines the IB grade assigned to a real mark.
  3. A Parrot class that repeats string input from the console until a secret phrase is entered.
  4. A Magnitude class which determines whether an integer is greater than, equal to, or less than another integer. Test with 25 randomly-generated integers, and a control integer from the user.
  5. A Palindrome class which determines whether two strings are matching palindromes (one string is the reverse of the other).
  6. An EvenOdd class which determines whether a given integer is even or odd.
  7. A SportsAdvice class which determines the appropriate sport to play, given the outdoor temperature.
  8. A FuelEconomy class which determines whether an economy, given in miles/gallon, is better than, equal to, or worse than an economy given in L/100 km.
  9. A CreditWatch class which determines whether a cardholder has exceeded her credit limit.
  10. A SalesCommission class which determines the commission payable on sales as follows: 1% of the first 1 000, 2% of the next 2 000, and 3% of the balance.
  11. A Payroll class which determines the regular and overtime (over 40 hrs/week) pay for hourly employees.
  12. A FederalIncomeTax class which determines the gross tax payable on income at each of the prescribed income bands.
  13. An IntegerSize class which determines which integer is the biggest-so-far of all which have been read from the user.
  14. A CheckDigit class which determines whether the check digit appended to a 4-digit integer is correct.
  15. A BodyMassIndex class which determines whether a person's BMI is appropriate for her mass and height.
  16. A TelephoneNumber class which determines the number to be dialed from a string like “1 800 O-Canada.”
  17. A LeapYear class which determines whether a given year is a leap year. Hint: check the rules at a reputable site.
  18. A SimpleCalculator class.
  19. A Quadrilateral class which determines the type of figure, given the lengths of four sides and the degree of one angle, according to following criteria (name, all sides equal, opposite sides equal, internal angle is a right angle):
    • square, true, true, true
    • rectangle, false, true, true
    • rhombus, true, true, false
    • parallelogram, false, true, false
    • irregular, false, false, —

touque.ca > Education Commons > Java > Assignments > Selection

[This page last updated 2020-12-23 at 12h12 Toronto local time.]