Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1A). Write an application that creates a quiz, which contains at least 5 questio

ID: 3622204 • Letter: 1

Question

1A). Write an application that creates a quiz, which contains at least 5 questions about a hobby, popular music, astronomy, or any other personal interest. Each question should be a multiple choice question with at least 4 options. When the user answers the question correctly, display a congratulatory message. If the user responds to a question incorrectly, display an appropriate message as well as the correct answer. At the end of the quiz, display the number of correct and incorrect answers, and the percentage of correct answers. Save your file as Quiz.java.

1B). Modify the application above so that the user is presented with each question continually until it is answered correctly. Remove the calculation for percentage of correct answers--all users will have 100% correct by the time they complete the application. Save your file as Quiz2.java.

Explanation / Answer

Hope this helps. Let me know if you have any questions. Please rate. :) ----------------------Quiz.java---------------------- import java.util.Scanner; public class Quiz { public static void main(String[] args) { int choice; int numCorrect = 0; Scanner s = new Scanner(System.in); System.out.println("Which is not standard gear for rock climbing?"); System.out.println("1. Climbing shoes"); System.out.println("2. Harness"); System.out.println("3. Sweater"); System.out.println("4. Rope"); choice = s.nextInt(); if (choice == 3) { numCorrect++; System.out.println("That is correct!"); } else { System.out.println("Boo! Of course it's not that."); System.out.println("The correct answer was 3. Sweater"); } System.out.println(); System.out.println("Which is not a standard length for climbing ropes?"); System.out.println("1. 10 meters"); System.out.println("2. 60 meters"); System.out.println("3. 50 meters"); System.out.println("4. 70 meters"); choice = s.nextInt(); if (choice == 1) { numCorrect++; System.out.println("Good job!"); } else { System.out.println("Nope. That's standard."); System.out.println("The correct answer was 1. 10 meters"); } System.out.println(); System.out.println("Who is not a world renowned rock climber?"); System.out.println("1. Chris Sharma"); System.out.println("2. Bob Hope"); System.out.println("3. John Muir"); System.out.println("4. Dan Osman"); choice = s.nextInt(); if (choice == 2) { numCorrect++; System.out.println("Yeah, he doesn't climb."); } else { System.out.println("Wrong! He's totally a climber!"); System.out.println("The correct answer was 2. Bob Hope"); } System.out.println(); System.out.println("Which is the name of a climbing move?"); System.out.println("1. Mantle"); System.out.println("2. Dyno"); System.out.println("3. Heel hook"); System.out.println("4. All of the above"); choice = s.nextInt(); if (choice == 4) { numCorrect++; System.out.println("Correct. Awesome."); } else { System.out.println("That's not the best answer"); System.out.println("The correct answer was 4. All of the above"); } System.out.println(); System.out.println("What isn't a real rating for a climbing route?"); System.out.println("1. 5.10"); System.out.println("2. V7"); System.out.println("3. 6b"); System.out.println("4. Hard"); choice = s.nextInt(); if (choice == 4) { numCorrect++; System.out.println("Yeah, that's not technically a rating."); } else { System.out.println("Incorrect. That's a real rating."); System.out.println("The correct answer was 4. Hard"); } System.out.println(); System.out.println("Number of correct answers: " + numCorrect); System.out.println("Number of incorrect answers: " + (5 - numCorrect)); System.out.println("Percentage of correct answers: " + (numCorrect / 5.0 * 100) + "%"); } } -------------------------Quiz2.java------------------------------ import java.util.Scanner; public class Quiz2 { public static void main(String[] args) { int choice = 0; Scanner s = new Scanner(System.in); while (choice != 3) { System.out.println(); System.out.println("Which is not standard gear for rock climbing?"); System.out.println("1. Climbing shoes"); System.out.println("2. Harness"); System.out.println("3. Sweater"); System.out.println("4. Rope"); choice = s.nextInt(); if (choice == 3) { System.out.println("That is correct!"); } else { System.out.println("Boo! Of course it's not that."); } } choice = 0; while (choice != 1) { System.out.println(); System.out .println("Which is not a standard length for climbing ropes?"); System.out.println("1. 10 meters"); System.out.println("2. 60 meters"); System.out.println("3. 50 meters"); System.out.println("4. 70 meters"); choice = s.nextInt(); if (choice == 1) { System.out.println("Good job!"); } else { System.out.println("Nope. That's standard."); } } choice = 0; while (choice != 2) { System.out.println(); System.out.println("Who is not a world renowned rock climber?"); System.out.println("1. Chris Sharma"); System.out.println("2. Bob Hope"); System.out.println("3. John Muir"); System.out.println("4. Dan Osman"); choice = s.nextInt(); if (choice == 2) { System.out.println("Yeah, he doesn't climb."); } else { System.out.println("Wrong! He's totally a climber!"); } } choice = 0; while (choice != 4) { System.out.println(); System.out.println("Which is the name of a climbing move?"); System.out.println("1. Mantle"); System.out.println("2. Dyno"); System.out.println("3. Heel hook"); System.out.println("4. All of the above"); choice = s.nextInt(); if (choice == 4) { System.out.println("Correct. Awesome."); } else { System.out.println("That's not the best answer"); } } choice = 0; while (choice != 4) { System.out.println(); System.out .println("What isn't a real rating for a climbing route?"); System.out.println("1. 5.10"); System.out.println("2. V7"); System.out.println("3. 6b"); System.out.println("4. Hard"); choice = s.nextInt(); if (choice == 4) { System.out.println("Yeah, that's not technically a rating."); } else { System.out.println("Incorrect. That's a real rating."); } } choice = 0; System.out.println(); System.out.println("Good job!"); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote