Graderpractice for programmers

231322 Java U7 - Control Flow

Awaiting submission
  • Write a static method calculateGrade(double score)
    • ≥ 80.0 return "A"
    • ≥ 75.0 return "B+"
    • ≥ 70.0 return "B"
    • ...C+, C, D+, D, F
  • Read 1 double
  • Calc & print the grade
Awaiting submission
  • Copy Main71
  • Update main() to read ALL input
Hint: Ctrl+D / Cmd+D to finish input
Awaiting submission
  • Write a static method isAwesomeJob(String job)
    • Return true if job starts with "p" ...and job ends with "rogrammer"
    • Else return false
  • Read all jobs
    ...and print if they're awesome
The program must be case insensitive (programmer == Programmer)
Awaiting submission
  • Write a static method allPass(Scanner sc)
    • ...that reads a set of (double) scores
    • ...and returns true if ALL are ≥ 50.0d
Awaiting submission
  • Write a static method fizzBuzz(int n)
    • If n is divisible by 3 and 5, return "FIZZ BUZZ"
    • If n is divisible by 5 only, return "BUZZ"
    • If n is divisible by 3 only, return "FIZZ"
    • Else return ""
  • Create an IntStream using: IntStream.rangeClosed(1, 20)
  • For each, print the number AND its 'fizzBuzz' (trimmed)
Hints:
- n is divisible by 3 if (n % 3 == 0)
- n is divisible by 5 if (n % 5 == 0)
Awaiting submission
  • Read a set of doubles
    • Calc the average (sum / count)
    • Print (1dp with label)
  • If there are no doubles ...print "No data"
Awaiting submission
  • Read a set of ints
    • Calculate the maximum
    • Print (with label)
  • If there are no ints ...print "No data"
Awaiting submission
  • Read a set of Strings
    • Calculate the longest
    • Print (with label)
  • If there are no Strings ...print "No data"
Awaiting submission
  • Read an int
  • Print all squares less than it (including calculation)
Awaiting submission
  • Read credits (int) & GP (double)
  • Print GPA (1dp)
  • If GPA < 2.0
    • Calculate min credits to increase it
    • Print an explanation
  • Else
    • Print "Good work :)"