Description
In this assignment, you are required to implement an electronic programming quiz system. User can create
questions and preview the quiz.
Your Task
You are asked to write a Java program for the programming quiz system. There are two types of questions:
Multiple Choice Question and Ture/False Question. User can create questions using the system; and
preview the quiz, which display all questions in the system one by one. During the preview, the user can
attempt the quiz by entering his/her answers to questions. The system will then immediately check the
answer and calculate. After attempting all questions, the total score will be displayed. A sample run of the
program is shown as below (Green text refers to user input):
Please choose (c)reate a question, (p)review or (e)xit >> c
Enter the type of question (MC or TF) >> MC
Enter the question text >> Each primitive type in Java has a corresponding
class contained in the java.lang package. These classes are called ____
classes.
How many options? 4
Enter Option A (Start with * for correct answer) >> case
Enter Option B (Start with * for correct answer) >> primitive
Enter Option C (Start with * for correct answer) >> *type-wrapper
Enter Option D (Start with * for correct answer) >> show
How many points? 3
Please choose (c)reate a question, (p)review or (e)xit >> c
Enter the type of question (MC or TF) >> MC
Enter the question text >> A(n) ____ variable is known only within the
boundaries of the method.
How many options? 5
Enter Option A (Start with * for correct answer) >> method
Enter Option B (Start with * for correct answer) >> *local
Enter Option C (Start with * for correct answer) >> double
Enter Option D (Start with * for correct answer) >> instance
Enter Option E (Start with * for correct answer) >> global
How many points? 2
Please choose (c)reate a question, (p)review or (e)xit >> c
Enter the type of question (MC or TF) >> TF
Enter the question text >> Java is a free-form programming language.
Answer is True or False? True
How many points? 1
Please choose (c)reate a question, (p)review or (e)xit >> p
Each primitive type in Java has a corresponding class contained in the
java.lang package. These classes are called ____ classes. (3.0 Points)
A: case
B: primitive
C: type-wrapper
D: show
Enter your choice >> A
You are wrong. The correct answer is C.
A(n) ____ variable is known only within the boundaries of the method. (2.0
Points)
A: method
B: local
C: double
D: instance
E: global
Enter your choice >> B
You are correct!
Java is a free-form programming language. (1.0 Points)
True(T) or False(F) >> F
You are wrong. The correct answer is true.
The quiz ends. Your score is 2.0.
Please choose (c)reate a question, (p)review or (e)xit >> c
Enter the type of question (MC or TF) >> MC
Enter the question text >> A(n) ____ constructor is one that requires no
arguments.
How many options? 3
Enter Option A (Start with * for correct answer) >> class
Enter Option B (Start with * for correct answer) >> *default
Enter Option C (Start with * for correct answer) >> explicit
How many points? 2
Please choose (c)reate a question, (p)review or (e)xit >> c
Enter the type of question (MC or TF) >> TF
Enter the question text >> Javascript and Java are the same.
Answer is True or False? False
How many points? 0.5
Please choose (c)reate a question, (p)review or (e)xit >> p
Each primitive type in Java has a corresponding class contained in the
java.lang package. These classes are called ____ classes. (3.0 Points)
A: case
B: primitive
C: type-wrapper
D: show
Enter your choice >> C
You are correct!
A(n) ____ variable is known only within the boundaries of the method. (2.0
Points)
A: method
B: local
C: double
D: instance
E: global
Enter your choice >> B
You are correct!
Java is a free-form programming language. (1.0 Points)
True(T) or False(F) >> T
You are correct!
A(n) ____ constructor is one that requires no arguments. (2.0 Points)
A: class
B: default
C: explicit
Enter your choice >> C
You are wrong. The correct answer is B.
Javascript and Java are the same. (0.5 Points)
True(T) or False(F) >> T
You are wrong. The correct answer is false.
The quiz ends. Your score is 6.0.
Please choose (c)reate a question, (p)review or (e)xit >> e
Goodbye!
Question Class:
- This class represents the generic form of question. It contains the question text (qText) and
the point of a question (point).
- The grade method, which is an abstract method, has a parameter, answer (String). It returns
the points of the question if the answer is correct; zero otherwise.
- The getCorrectAnswer method, which is an abstract method, has no parameter. It returns a
String representing the correct answer to the question.
MCQuestion Class
- It is a subclass of Question.
- It represents a multiple-choice question. A multiple-choice question may have 3-5 options.
- Each element of the instance variable options refers to an option in this question.
- The instance variable answer is a single-character string. It saves the correct answer (“A”,
“B”, “C”, “D” or “E”) to this question.
Step by stepSolved in 2 steps
- Draw Design Layout References Mailings Review View Help Create a Java program and name your file: FIRSTNAME. java (for example, lohn.java). Work on the following: Create three interfaces with the names "InterfaceOne," "IrnterfaceTwo," and "Interfacelhree" In the first interface, declare a method (signature only) with a name "updateGear()." In the second interface, dedare a method (signature only) with a name "accelerate()." In the third interface, dedare a method (signature only) with a name "pusherake()." Create two classes Car and Truck that implement these three interfaces at one time. Define a new method "currentSpeed()" in both the classes to find the current speed after the brake. • Define all the three methods inside each class. The data to these methods will be provided during the object creation. Invoke the two objects with a name c1 of class Car and t1 of class Truck. • After creating the objects, call all the three methods defined above in both the classes. Pass any of the…arrow_forwardWrite a GUI-based program that plays a guess-the-number game in which the roles of the computer and the user are the reverse of what they are in the Case Study of this chapter. In this version of the game, the computer guesses a number between 1 (lowerBound) and 100 (upperBound) and the user provides the responses. The window should display the computer’s guesses with a label. The user enters a hint in response, by selecting one of a set of command buttons labeled Too small, Too large, and Correct. When the game is over, you should disable these buttons and wait for the user to click New game, as before. Be sure to use the field names provided in the comments in your starter code. An example of the program is shown below: Is the number 50? Too small Too large correct new game 1.GUI TestI Guessing 79 2. GUI Test Guessing 18 and resetting gamearrow_forwardIn java language Class Design – Date V0.0 & V1.0 Create a new project for this lab and create a new class inside called Date. If you created a Date class last week, you may use it as a base. What does it mean to be a Date? What data items (called “state”) do you need to keep track of? Alternatively, what does a date have? (“has a” == composition) What can a Date do? What are the actions and verbs that can be applied to a date? Come up with one or two. These become the class’s methods. Try adding 3 data items to your Date to manage the month, day and year. Should these be local variables? Class-level (or instance) variables? Now let’s build a method to set the date This function should take 3 integers as input and assign these to your instance variables declared in the previous step. public void setDate(int m, int d, int y) { And, let’s build a method to report the date This function takes no input and uses the console to output the Date in the format…arrow_forward
- True or False An interface must be instantiated before it can be used.arrow_forwardMake any necessary modifications to the RushJob class so that it can be sorted by job number. Modify the JobDemo3 application so the displayed orders have been sorted. Save the application as JobDemo4. An example of the program is shown below: Enter job number 22 Enter customer name Joe Enter description Powerwashing Enter estimated hours 4 Enter job number 6 Enter customer name Joey Enter description Painting Enter estimated hours 8 Enter job number 12 Enter customer name Joseph Enter description Carpet cleaning Enter estimated hours 5 Enter job number 9 Enter customer name Josefine Enter description Moving Enter estimated hours 12 Enter job number 21 Enter customer name Josefina Enter description Dog walking Enter estimated hours 2 Summary: RushJob 6 Joey Painting 8 hours @$45.00 per hour. Rush job adds 150 premium. Total price is $510.00 RushJob 9 Josefine Moving 12 hours @$45.00 per hour. Rush job adds 150 premium. Total price is $690.00 RushJob 12 Joseph Carpet cleaning 5 hours…arrow_forwardIn python and include doctring: First, write a class named Movie that has four data members: title, genre, director, and year. It should have: an init method that takes as arguments the title, genre, director, and year (in that order) and assigns them to the data members. The year is an integer and the others are strings. get methods for each of the data members (get_title, get_genre, get_director, and get_year). Next write a class named StreamingService that has two data members: name and catalog. the catalog is a dictionary of Movies, with the titles as the keys and the Movie objects as the corresponding values (you can assume there aren't any Movies with the same title). The StreamingService class should have: an init method that takes the name as an argument, and assigns it to the name data member. The catalog data member should be initialized to an empty dictionary. get methods for each of the data members (get_name and get_catalog). a method named add_movie that takes a Movie…arrow_forward
- In this Assignment we will build a simple graphical application that is responsive and that uses basic widgets and demonstrates event handling. The screen shot below shows the expected result In this Assignment we will build a simple graphical application that is responsive and that uses basic widgets and demonstrates event handling. The screen shot below shows the expected result You must not use any other library except tkinter. Your code must run on a standard machine. Your code must be written as a class that inherits from Tk and the application must resize gracefully. The apps must start in a usable state i.e. all the relevant values of the input widget must be set. So if you click ok when the app starts, then you should get the pop-up message shown in the last page. The reset button must set the app to the initial start state. Widget must align vertically as well as horizontally with their matching widget Application not designed as a class. Application not responsive: The…arrow_forwardDesign a class named CustomerRecord that holds a customer number, name, and address. Include separate methods to 'set' the value for each data field using the parameter being passed. Include separate methods to 'get' the value for each data field, i.e. "return" the field's value. Pseudocode:arrow_forwardGiven two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar object that performs the following operations: Drives input number of miles forward Drives input number of miles in reverse Honks the horn Reports car status The SimpleCar class is found in the file SimpleCar.java. Ex: If the input is: 100 4 the output is: beep beep Car has driven: 96 miles // Simulates a simple car with operations to drive and check the odometer.public class SimpleCar { // Number of miles driven private int miles; public SimpleCar(){ miles = 0; } public void drive(int dist){ miles = miles + dist; } public void reverse(int dist){ miles = miles - dist; } public int getOdometer(){ return miles; } public void honkHorn(){ System.out.println("beep beep"); } public void report(){ System.out.println("Car has driven: " + miles + " miles"); } }arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY