Question

Hello need assistance with Java program: You are asked to create a program that will be...

Hello need assistance with Java program:

You are asked to create a program that will be used to create quizzes and test users based on these

quizzes.

1.    Prompt a secret word and proceed if it matches a secret code.

2.    Your program should have two modules: quiz creation mode and test mode. User will be

prompted in the beginning to choose from these two modes. For example:

“Welcome to the quiz master: please enter 1 if you want to manage questions, 2 if you want to

take a quiz, 3 if you want to exit”

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import java.util.Scanner;
public class Solution3 {

   public static void main(String[] args) {
      
       quiz q=new quiz();
      
       Scanner s=new Scanner(System.in);
   System.out.println("Welcome to the quiz master:\nplease enter 1 if you want to manage questions,\n2 if you want to take a quiz,\n3 if you want to exit");
  
   boolean repeat=true;
     
   while(repeat)
   {
   int choice=s.nextInt();
   s.nextLine();
   switch(choice)
   {
   case 1:
   {
       q.manage_quiz();
       System.out.println(q.secret_code);
       break;
   }
     
     
   case 2:
   {
       String word=s.next();
       boolean result= q.test_quiz(word);
       if(result)
           System.out.println("entered word matched with secret code");
       break;
   }
     
   case 3:
   {
         
   repeat=false;
       break;
   }
     
      
   }
   }
     
  
   }
}


class quiz{
   String secret_code;
  
   public String manage_quiz()
   {
       Scanner s=new Scanner(System.in);
       secret_code=s.nextLine();
       return secret_code;
   }
  
   public boolean test_quiz(String word)
   {
       if(word.equals(secret_code))
           return true;
       else
           return false;
   }
  
  
}

Add a comment
Know the answer?
Add Answer to:
Hello need assistance with Java program: You are asked to create a program that will be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA Project Please have the code written in JAVA This is a game I am trying...

    JAVA Project Please have the code written in JAVA This is a game I am trying to develop. Please let me know if its possible and what the base code is. Prompt User “Hello! Welcome to the game.” Prompt User “To begin the game, please enter a letter” Random word generator, will set the String to a new word After the user inputs a letter, the computer will enter a loop Once in the loop the computer will test each...

  • what is the solution for this Java project? Create the an application that can use different...

    what is the solution for this Java project? Create the an application that can use different types of Linked List to manage either Checking Account or Saving Account. The application should allow users can select the type of Linked List to work on. After finishing one, users can select to work with other type of Linked List until they want to exit Singly Linked List Singly Linked List with Iterator Java Linked List with Iterator 1. 2. 3. You can...

  • Java program Program: Grade Stats In this program you will create a utility to calculate and...

    Java program Program: Grade Stats In this program you will create a utility to calculate and display various statistics about the grades of a class. In particular, you will read a CSV file (comma separated value) that stores the grades for a class, and then print out various statistics, either for the whole class, individual assignments, or individual students Things you will learn Robustly parsing simple text files Defining your own objects and using them in a program Handling multiple...

  • Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows...

    Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows users to register and login into the system. The focus of this project is for you to create an app with several activities and has data validation. You should have for your app: A welcome screen (splash screen) with your app name and a picture. You should then move to a screen that asks the user for either to log in or to register....

  • Create a new class MathOP2 (MathOP2.java) that Inherits from MathOP You need to add multiply method...

    Create a new class MathOP2 (MathOP2.java) that Inherits from MathOP You need to add multiply method and divide method, both methods accepts two parameters and return a value. Create a test program with documentation to test all operators (at least 4) The TestMathOP should do the following      Enter the First number >> 5.5      Enter the Second Number >> 7.5      The sum of the numbers is 13      The subtract of the two numbers is -2.00      Do...

  • Create a new program, WordGuessingGame. Using a while loop, create a game for the user. The...

    Create a new program, WordGuessingGame. Using a while loop, create a game for the user. The game requires the user to guess a secret word. The game does not end until the user guesses the word. After they win the game, they are prompted to choose to play again. The secret word that user must guess is "valentine". It is a case-sensitive analysis With each guess... If the guess does not have an equal number of characters, tell the user...

  • Using Java, please create the program for the following prompt. MUST CREATE BUTTONS IN A JFRAME,...

    Using Java, please create the program for the following prompt. MUST CREATE BUTTONS IN A JFRAME, as specified by the prompt! DO NOT use user input of 1, 2, 3 etc. User input must come from clicking the buttons. Please be sure to test your program. Thank you! Write a program that displays three buttons with the names or images of three candidates for public of office. Imagine that a person votes by clicking the button that shows the candidate...

  • I need to create a Phyton program 1. Contains the following steps:    a) Create a...

    I need to create a Phyton program 1. Contains the following steps:    a) Create a loop where you prompt the user to enter integers and calculate the average of the numbers entered. Exit the loop when the entered number is 0.    b) Test Program_A works as designed.    c) Use as a template Program_A, create a new file Program_B which uses a similar loop and calculates the max in the list.    d) Test Progam_B

  • I need to write a java program call atm machine. Simulate An Atm Machine. create 10...

    I need to write a java program call atm machine. Simulate An Atm Machine. create 10 accounts in an array with id,…,9 and an initial balance of $100. The Systems Prompts the user to enter an id. If the id is entered incorrectly it will ask the user to enter a correct id. Once an id is accepted, the main menu is displayed as shown in the sample run. You can choice 1 for viewing the current balance, 2 for...

  • You will write a single java program called MadLibs. java.

    You will write a single java program called MadLibs. java. This file will hold and allow access to the values needed to handle the details for a "MadLibs" game. This class will not contain a maino method. It will not ask the user for any input, nor will it display (via System.out.print/In()) information to the user. The job of this class is to manage information, not to interact with the user.I am providing a MadLibsDriver.java e^{*} program that you can...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT