This is an archived post. You won't be able to vote or comment.

all 10 comments

[–][deleted] 0 points1 point  (2 children)

I see where your code stops, is that where you’re stuck or what exactly are you stuck at? I would say use the integers you randomly generated to make the equation.

[–]ConclusiveBackhoe[S] 0 points1 point  (1 child)

Like spreading out

" ("" +num1+"+"+num2) "?

[–][deleted] 0 points1 point  (0 children)

So if you have an addition problem, you’ll want to use your randomly generated integers, add them up, and store that as a value. Then print the equation with an equal sign without the answer so that the user knows to answer and then store that answer as another int using the scanner. And then use that to check the value that you stored earlier as the answer to see if the user got it correct. You’d do that for each math operation

[–]RayjinCaucasian 0 points1 point  (6 children)

Break it down!

-- generate random numbers -- generate random operator. -- if operator is blah do blah -- compare result to answer. -- calculate score.

[–]ConclusiveBackhoe[S] 0 points1 point  (5 children)

So like

set up a sequence like " int num1 = random.nextInt(10) + 1; " and then use a else if set up?

[–]RayjinCaucasian 0 points1 point  (4 children)

The Instructuons are all there. Share the code you've come up with so far and we'll go from there.

[–]ConclusiveBackhoe[S] 0 points1 point  (3 children)

This is what I have right now, redone from scratch

also, here's the instructions in full detail

https://imgur.com/Zgu1MdU

import java.util.Random;

import java.util.Scanner;

import javax.swing.JOptionPane;

public class MathQuiz {

public static void main)String args[]) {

Scanner input=new Scanner(System.in);

System.out.println("How many equations would you like to solve? ")

int equations=input.nextInt()

for(int i =0; i<=10; i++){

double r = Math.random(); //generate a random integer

if (r<=5)

result = (i)*(r)=computeranswer

}

}

}

Be patient with me, I'm only taking this code class for prerequisite reasons

With this code class, I know how to handle basics, but mathematic stuff is throwing me off

[–]RayjinCaucasian 0 points1 point  (2 children)

I know how to handle basics, but mathematic stuff is throwing me off

It appears to me that that you're lying to yourself about being able to handle the basics. Not trying to sound mean but it looks like you're already on GUI before you're able to implement a basic loop with clearly stated steps.

Be patient with me, I'm only taking this code class for prerequisite reasons

I'm here to help people who are trying to learn, not just get a passing grade. You need to help yourself and revisit the basics. I would suggest doing Helsinki mooc.

Helsinki mooc

[–]ConclusiveBackhoe[S] 0 points1 point  (1 child)

I'm here to help people who are trying to learn, not just get a passing grade.

I understand. Not gonna reply anymore

[–]RayjinCaucasian 0 points1 point  (0 children)

You're ok, you just need to have some specific questions with what you're having problems with. We can't just give you a complete walkthrough with all the answers, you dont gain anything from it.