What's new

Closed Mini multiplication game

Status
Not open for further replies.

Princess Serrano

Eternal Poster
Joined
Apr 2, 2016
Posts
429
Reaction
285
Points
321
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 ++ ;
}

}
}
 
Last edited:
Princess Serrano
OK na yung logic mo. Puwede na. Pero...
Ang pag-aralan mo na lang Object Oriented Programming kasi old-fashion procedural pa rin yung style mo.
Hindi papasa yan sa job testing.

Nakakatakot, napakahaba at nakakalula ang codes mo.. :)

Pag-aralan mong gumawa ng mga RE-USABLE routines or methods or functions para mas compact at walang repetition sa application mo.

i-break mo yung comfort zone mo. Meron kang potential.
 
gerald1968
OOP ay yon na ang hanap ng mga company ngayon.
Lalo na yung mga application developer companies na kailangan nila ng member programmers on APPLICATION PORTION basis. Yung may papagawa lang sa iyo na konting portion sa isang existing application.

Sa OOP kasi mas madaling gumawa ng application (mapa Java, C++, C#, etc.) kasi puwede parts by parts ang development. Ang codes ay divided into small parts para madaling i-design at i-debug at mas madaling basahin ng members ng team.

Madaling magdagdag ng features sa existing application. Konting edit lang at hindi nagagalaw ang ibang parts ng codes. Walang repetition ng codes. Simplified ang task ng isang method. etc.
 
Princess Serrano
OK na yung logic mo. Puwede na. Pero...
Ang pag-aralan mo na lang Object Oriented Programming kasi old-fashion procedural pa rin yung style mo.
Hindi papasa yan sa job testing.

Nakakatakot, napakahaba at nakakalula ang codes mo.. :)

Pag-aralan mong gumawa ng mga RE-USABLE routines or methods or functions para mas compact at walang repetition sa application mo.

i-break mo yung comfort zone mo. Meron kang potential.
Haha kuya im a beginner lang po sa programming, kaya di pa po ako ganun kagalingan pero salamat din po. Di ko alam yung OOP haha. Pati hanggang console lang po yung napag aralan namen e
 
Status
Not open for further replies.

Similar threads

Back
Top