Revise the following code so that it uses a while loop instead of a do-while loop:
Scanner keyboard = new Scanner(System.in);
int number;
do
{
System.out.println("Enter a whole number:");
number – keyboard.nextInt();
System.out.println("You entered" + number);
} while (number > 0);
System.out.println("number after loop = '' + number);
Want to see the full answer?
Check out a sample textbook solutionChapter 4 Solutions
Java: An Introduction To Problem Solving And Programming Plus Mylab Programming With Pearson Etext -- Access Card Package (8th Edition)
Additional Engineering Textbook Solutions
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Modern Database Management
Starting Out with C++: Early Objects (9th Edition)
Starting Out With Visual Basic (8th Edition)
SURVEY OF OPERATING SYSTEMS
Concepts Of Programming Languages
- (Using R language)arrow_forwardAfter our initial deployment for our ML home based security system, the first steps we took to contribute further to the project, we conducted load testing, tested and optimize for low latency, and automated user onboarding. What should be next?arrow_forwardWhy investing in skills and technology is a critical factor in the financial management aspect of system projects.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr