Question: Here is my Java Code. I have 10 questions that are as follows (I only pasted two cause the rest are the same). Using conditions

Here is my Java Code. I have 10 questions that are as follows (I only pasted two cause the rest are the same). Using conditions show the users score out of 10 at the end of the program. So at the end it would say Student 1s score is __/10.

import java.util.Scanner;

public class IOPracticeTask01 {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner reader= new Scanner (System.in);

//Username+ Password

System.out.print("Enter Email Address:");

String email=reader.nextLine();

System.out.print("Enter Password:");

String password=reader.nextLine();

//First+last name

System.out.print("Enter First Name:");

String firstname=reader.nextLine();

System.out.print("Enter Last Name:");

String lastname=reader.nextLine();

System.out.println("-------------------------------------------");

System.out.println("Division Quiz #1 "+firstname+" "+lastname+" "+email+"");

//Get random numbers between 10 and 99

//Question 1

int howmanycorrect;

int divendend1 = (int)(Math.random() * ((99 - 10) + 1)) + 10;

int divisor1 = (int)(Math.random() * ((9 - 1) + 1)) + 1;

int divisionone= (int)(divendend1/divisor1);

int remainder1= (int)(divendend1%divisor1);

String correctanswer= divisionone+"r"+remainder1+" ";

System.out.print("1)"+divendend1+"/"+divisor1+"=?");

System.out.print(" ");

String correct=reader.nextLine();

System.out.println("Correct Answer:"+divisionone+"r"+remainder1);

//Question 2

int divendend2 = (int)(Math.random() * ((99 - 10) + 1)) + 10;

int divisor2 = (int)(Math.random() * ((9 - 1) + 1)) + 1;

int divisiontwo= (int)(divendend2/divisor2);

int remainder2= (int)(divendend2%divisor2);

System.out.print("2)"+divendend2+"/"+divisor2+"=?");

System.out.print(" ");

String correct2=reader.nextLine();

System.out.println("Correct Answer:"+divisiontwo+"r"+remainder2);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!