CIS 1068 Lecture Notes - Lecture 14: Switch Statement

24 views2 pages

Document Summary

* to change this license header, choose license headers in project. * to change this template ile, choose tools | templates. * and open the template in the editor. Matching (if/else or switch statement) package lab5slotmachine; import java. util. random; import java. util. scanner; public class lab5slotmachine { public static void main(string[] args) { int input1, input2, input3; Random rnd = new random(); int irstnumber = rnd. nextint(6) + 1; int secondnumber = rnd. nextint(6) + 1; int thirdnumber = rnd. nextint(6) + 1; Scanner keyboard = new scanner(system. in); input1 = keyboard. nextint(); input2 = keyboard. nextint(); input3 = keyboard. nextint(); if (((input1 == irstnumber) && (input2 == secondnumber) && (input3. || ((input2 == irstnumber) && (input3 == secondnumber) && (input1 == thirdnumber)) || ((input1 == secondnumber) && (input3 == irstnumber) && (input2 == thirdnumber))) { } else if (((input1 == irstnumber) && (input2 == secondnumber)) || (input1 == irstnumber) && ((input3 == thirdnumber) || (input1 == secondnumber) && (input2 == irstnumber)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions