dimanche 1 septembre 2019

If else program

i have a problem with my last if else statement. it keeps telling me "else without if" 

import java.util.Scanner;
public class DartBallGame {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Welcome to the lucky dart ball game");
        System.out.println("Enter the dimension of your square board: ");
        double SideSize = input.nextDouble();
        System.out.println("Enter the radius of your dart ball, your radius has to be between a range of 1-" + SideSize / 3);
        double radius = input.nextDouble();
        if (radius > SideSize / 3) {
            radius = SideSize / 3;
            System.out.println("Your radius can't be greater than " + SideSize / 3 + " Your new radius is " + SideSize / 3);
        }


        int computersguess = 0;

        //Make a guess
        System.out.println("Let's play, create your own chance");
        System.out.println("Pick a number between 10 and 99");
        int playersguess = input.nextInt();

        if (playersguess < 99 && playersguess > 10)
            computersguess = (int) (Math.random() * 10);
            int computersguess2 = (int) (Math.random() * 10);
            System.out.println("My guess is " + computersguess + computersguess2);
        else
        System.out.println("Your number is not between 10 and 99, please reset game");
}

} how do i correct the if else issue :)

please ignore asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv asdds df safd dsf dsfa df asd fsd fsd f re t vrt v rtv 35tv35tv

Aucun commentaire:

Enregistrer un commentaire