🔒 Closed Mini multiplication game

Status
Not open for further replies.

Princess Serrano

Honorary Poster
Multiplication mini game. Have a try :)


import java.util.*;

public class Main
{
public static void main(String[] args)
{

Scanner Princess = new Scanner ( System.in ) ;

int level = 1 ;
int hard = 10 ;
int hard1 = 10 ;

while ( true ) {
int answer = 0 ;
int wrong = 0 ;
int score = 0 ;
String uncorrect = "" ;

System.out.println ( "\nLevel -->> "+level+" << -- \nWelcome to the multiplication Quiz.\n" ) ;

for ( int a = 0 ; a < 10 ; a ++ ) {
int ranDom1 = new Random ( ) . nextInt ( hard ) ;
int ranDom2 = new Random ( ) . nextInt ( hard1 ) ;
System.out.print ( ( a + 1 ) + ".) " + ranDom1 + " * " + ranDom2 ) ;
while ( true ) {
System.out.print ( "\tAnswer: " ) ;

if ( !Princess.hasNextInt ( ) ) {
System.out.println ( "Input an integer." ) ;
Princess.next ( ) ;
} else {
answer = Princess.nextInt ( ) ;
break ;
}
}

if ( ranDom1 * ranDom2 != answer ) {
uncorrect += " #" + ( a+1 );
wrong++ ;
} else {
}
}

score = ( 3 * ( 10 - wrong ) ) + 70 ;

hard += score / 40 ;
hard1 += score / 20 ;

System.out.println ( "\nGrade Percentage: " +score+ "% | " + ( 10 - wrong ) + "/10 " ) ;
System.out.println ( score == 100 ? "Perfect." : "Mistake:" +uncorrect ) ;
level ++ ;
}

}
}
 
Status
Not open for further replies.

About this Thread

  • 7
    Replies
  • 624
    Views
  • 4
    Participants
Last reply from:
Princess Serrano

Online now

Members online
423
Guests online
1,707
Total visitors
2,130

Forum statistics

Threads
2,275,507
Posts
28,963,744
Members
1,232,820
Latest member
bababozooo67
Back
Top