mercredi 30 septembre 2015

At the end of the Quiz display number of correct answer and incorrect answer + percentage of correct answer?

import java.util.Scanner;

/*The Circle Rock Paper scissors game implement to display to the standard output.
@author Mun
@class CIS168
@date 9/28/2015*/
public class Quiz{

   public static void main(String[] args)

   {

int choices;
 int song;
 int song2;
 int song3;
 int song4;
 int song5;  

// scanner to input singer name Scanner scan = new Scanner(System.in); // Display a song to input singer name System.out.println("Who sing this the song 'Locked Away':");

      System.out.println("Choose 1 for R. City & Adam Levine's. \nChoose 2 for Justin Bieber.  \nChoose 3 for Selena Gomez. \nChoose 4 for Katy Perry.");
      song = scan.nextInt();




if (song!=1){

System.out.println("Your answer is incorrect  R. City & Adam Levine's is the right answer .");


   }

{

   while(song==1){

        System.out.println( "Congrate you answer is correct");

song++;
  } 
     System.out.println();     
  }  

// Display a song to input singer name System.out.println("Who sing this the song 'Beauty and the beast':");

      System.out.println("Choose 1 for R. City & Adam Levine's. \nChoose 2 for Justin Bieber.  \nChoose 3 for Selena Gomez. \nChoose 4 for Katy Perry.");
    song2 = scan.nextInt();



if (song2!=2){

System.out.println("Your answer is incorrect  Justin Bieber is the right answer.");


   }

{

   while(song2==2){

        System.out.println( "Congrate you answer is correct ");

song2++;
  } 
     System.out.println();     
  }  

System.out.println("Who sing this the song 'Heal the world':");


      System.out.println("Choose 1 for R. City & Adam Levine's. \nChoose 2 for Micheal Jackson.  \nChoose 3 for Selena Gomez. \nChoose 4 for Katy Perry.");
    song4 = scan.nextInt();



if (song4!=2){

System.out.println("Your answer is incorrect  Micheal Jackson is the right answer.");


   }

{

   while(song4==2){

        System.out.println( "Congrate you answer is correct");

song4++;
  } 
     System.out.println();     
  }  

System.out.println("Who sing this the song 'Roar':");


      System.out.println("Choose 1 for R. City & Adam Levine's. \nChoose 2 for Justin Bieber.  \nChoose 3 for Selena Gomez. \nChoose 4 for Katy Perry.");
 song3 = scan.nextInt();



if (song3!=4){

System.out.println("Your answer is incorrect  Katy Perry is the right answer.");


   }

{

   while(song3==4){

        System.out.println( "Congrate you answer is correct");

song3++;
  } 
     System.out.println();     
  }  

System.out.println("Who sing this the song 'The Heart Wants What It Wants ':");


      System.out.println("Choose 1 for R. City & Adam Levine's. \nChoose 2 for Justin Bieber.  \nChoose 3 for Selena Gomez. \nChoose 4 for Katy Perry.");
  song5 = scan.nextInt();



if (song5!=3){

System.out.println("Your answer is incorrect  Salena Gomez is the right answer.");


   }

{

   while(song5==3){

        System.out.println( "Congrate you answer is correct");

song5++;
  } 
     System.out.println();     
  } 
  switch (song){
  case 1: song1=1;
   result=1;

System.out.println(song);


          } //calculate correct answer here

        }//how I will calculate how many wrong and right answer I got and percentage //of total correct answer.
        }

Aucun commentaire:

Enregistrer un commentaire