Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Java Foundations
Quiz 5: Writing Classes
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Short Answer
Write a method called containsPair that takes in three integer parameters and returns true if any two of the input parameters are the same.
Question 22
Essay
Consider the following method. public void changeValues(int i, Card c) { i = 15; c.setSuit(“Clubs”); } Now consider the following snippet of code that calls the method defined above. int num = 12; Card fiveOfSpades = new Card(5, “Spades”); System.out.println(“Before method call:”); System.out.println(num); System.out.println(fiveOfSpades.getSuit()); changeValues(num, fiveOfSpades); System.out.println(“After method call:”); System.out.println(num); System.out.println(fiveOfSpades); What is the output of this code?
Question 23
Short Answer
Write a method called randomAverage that generates 100 random integers in the range 1 to 100 (inclusive) and returns their average. You may assume that the class has a static Random object called generator already declared and instantiated.