Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please write this code with comments in java. My fraction class wasn't good and I am just struggling with this. Please do everything

Can someone please write this code with comments in java. My fraction class wasn't good and I am just struggling with this. Please do everything asked and add detailed comments that way I understand what is going on.

Write a program to interactively quiz a student on fraction operations. Since this program is interactive, the workbench is not suitable for testing. You should develop the program using an IDE of your choice, I recomment jgrasp, but eclipse is also a good choice. When complete, you should create files on the workbench and copy/paste your code into those files on workbench for submission.

You should use the Fraction class that you developed in lab on 3/22, but you will almost certainly need to enhance it. You can also use the Dice class that was demonstrated in class to generate random numbers. You should find the Dice class in the book at the end of chapter 6. You will need this class (or something similar) to generate random numbers for quizzing the student.

Your program should allow the student to select the type of quiz and the number of questions. The type of quiz will be either (1) arithmetic or (2) relational. In an arithmetic quiz, the student will be given random fractions and asked to either add, subtract, multiply, or divide them. In a relational quiz, the student will be given two random fractions and need to identify which is largest or if they are equal. Your program will keep track of how many correct answers are given and report that at the end of the quiz.

Your program should also allow the student to enter a difficuly level before starting the quiz. The difficulty level will be an integer that represents the largest number that can be generated for the numerator or denominator of your fraction. So on a difficulty level of 9, all numerators and denominators will be 9 or less. The answer to quiz questions might have larger numbers however.

Hints: This should be obvious by now, but you need to spend some time thinking about the design. Note that the structure of the quiz logic is really unrelated to the type of question you are asking. If you find yourself getting a bit confused, think about writing a similar quiz that just uses integers and not fractions for the questions. Good modularity will help. A method that generates a questions, gets the answer, checks the answer, and returns true or false (which you interpret as correct or incorrect) would be good. It probably has helper methods like one to make a random fraction, one to choose a random math operation, etc. If you have a method to do one question, then a loop to call that method repeatedly should be simple. Start early. Ask questions. Have some fun with this.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

Define the following: a. Asset b. Liability c. Net asset

Answered: 1 week ago

Question

Define Administration?

Answered: 1 week ago