ITSS 3312 Lecture Notes - Lecture 6: Method Stub

20 views3 pages

Document Summary

// todo auto-generated method stub import java. util. scanner; public class guessinggame { int low =1, high =100; Scanner input = new scanner (system. in); while (true) { int mid = (low+ high)/2; String response =input. next(); if (response. equals ("")) if (low == high) System. out. println("your guess is " + low); high =mid-1; low=mid+1; break; public static void main(string[] args) { // todo auto-generated method stub import java. util. public class guessinggame2 { Random rand = new random(); int number = rand. nextint(100) + 1; System. out. println("ok, i am ready with a number! int tries =0; while (true) { System. out. println("enter your guess: " ); int guess = input. nextint(); if(number ==guess) if (number guess) You got in " + tries + "tries! public static void main(string[] args) { // todo auto-generated method stub value *= 10; System. out. println(i + ":" + bigvalue); smallvalue /= 10; double value2 = smallvalue +1;

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