Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are to write a program called MinilabLoops. It will ask the user for 2 integers (making sure that the second one is larger) and
You are to write a program called MinilabLoops. It will ask the user for 2 integers (making sure that the second one is larger) and then show the user a menu so they can choose the next step. Their options will be to print integers in some order or to find the total. Please see the Minilab_5_Loops_Example.txt file to see what the program should do with example input. Hints: For some options, you will have to print integers on the same line with a single space in between. To do this, be sure to use a System.out.print inside your loop to print a number and then a on the same line. Then, when the loop is finished, your code should so a single System.out.println(); so the next output is not on the same line, too. . The System.out.println(); described above is the only time your should have to skip a line like that. In general, it is better to print a newline and then some text rather than printing some text and then a newline. So most of your code should generate blank lines with code such as this: System.out.println(" Please choose an option); . Notice that the number options in the menu have 2 spaces before and after them. Testing: Be sure that your program is called MinilabLoops.java and compiles. You should make sure that your program works with the example input shown. You should also test it with other input that you make up yourself. Comments and formatting: Please put in an opening comment that briefly describes the purpose of your program. This should be from the perspective of a programmer instead of a student, so it should tell what the program does. It should also have your name and class on a separate line. In the code itself, indent inside the class and then again inside main. Also, please be sure that your indenting is correct, your variable names are meaningful, and there is "white space (blank lines) to make each part of your program easily readable. This is all for Maintainability and deductions for lack of maintainability will be up to 10% of your program. Maintainability: The program should be maintainable. It should have an opening comment to explain its purpose, comments in the code to explain it, correct indenting, good variable names, and white space to help make it readable. Please submit: Your MinilabLoops.java on Canvas. You will have to submit your program and make sure it passes all different Test Cases below: You are to write a program called MinilabLoops. It will ask the user for 2 integers (making sure that the second one is larger) and then show the user a menu so they can choose the next step. Their options will be to print integers in some order or to find the total. Please see the Minilab_5_Loops_Example.txt file to see what the program should do with example input. Hints: For some options, you will have to print integers on the same line with a single space in between. To do this, be sure to use a System.out.print inside your loop to print a number and then a on the same line. Then, when the loop is finished, your code should so a single System.out.println(); so the next output is not on the same line, too. . The System.out.println(); described above is the only time your should have to skip a line like that. In general, it is better to print a newline and then some text rather than printing some text and then a newline. So most of your code should generate blank lines with code such as this: System.out.println(" Please choose an option); . Notice that the number options in the menu have 2 spaces before and after them. Testing: Be sure that your program is called MinilabLoops.java and compiles. You should make sure that your program works with the example input shown. You should also test it with other input that you make up yourself. Comments and formatting: Please put in an opening comment that briefly describes the purpose of your program. This should be from the perspective of a programmer instead of a student, so it should tell what the program does. It should also have your name and class on a separate line. In the code itself, indent inside the class and then again inside main. Also, please be sure that your indenting is correct, your variable names are meaningful, and there is "white space (blank lines) to make each part of your program easily readable. This is all for Maintainability and deductions for lack of maintainability will be up to 10% of your program. Maintainability: The program should be maintainable. It should have an opening comment to explain its purpose, comments in the code to explain it, correct indenting, good variable names, and white space to help make it readable. Please submit: Your MinilabLoops.java on Canvas. You will have to submit your program and make sure it passes all different Test Cases below
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started