Write a Java statement or a set of Java statements to accomplish each of the following tasks:
Print the integers from 1 to 20, using a while loop and the counter variable i. Assume that the variable i has been declared, but not initialized. Print only five integers per line. [Hint: Use the calculation i % 5. When the value of this expression is 0, print a newline character; otherwise, print a tab character. Assume that this code is an application. Use the System.out.println() method to output the newline character, and use the System.out.print('\t') method to output the tab character.]
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Java How to Program, Early Objects Plus MyLab Programming with Pearson eText -- Access Card Package (11th Edition)
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Python (3rd Edition)
Starting Out with Java: Early Objects (6th Edition)
Computer Science: An Overview (12th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
- PROBLEM: Write a program that prompts the user to input the amount of money that an ATM machine will dispense and then show the breakdown of how many 1000, 500, and 100 peso bill/s are dispensed. The program must display the amount then prompt the user if the transaction will continue or not by choosing between Y (for Yes) and N (for No). If an invalid character is entered, it must display that the user entered an invalid character. The program must also display that the maximum allowable amount is 10,000 and the minimum allowable amount is 100. If the entered amount is greater than 10,000 or less than 100, an error notification must be displayed. Moreover, the entered amount must be exactly divisible by 100. SPECIFICATIONS: - You may only use the codes that we studied under our lectures All lines of codes should have a comment. - Save your cpp file as Surname - PE (Example: Pangaliman - PE.cpp) TEST CASES: If a user inputs an amount less than or equal to 10,000: REMINDER: Maximum…arrow_forwardPROBLEM:Write a program that prompts the user to input the amount of money that an ATM machine will dispense and then show the breakdown of how many 1000, 500, and 100 peso bill/s are dispensed. The program must display the amount then prompt the user if the transaction will continue or not by choosing between Y (for Yes) and N (for No). If an invalid character is entered, it must display that the user entered an invalid character. The program must also display that the maximum allowable amount is 10,000 and the minimum allowable amount is 100. If the entered amount is greater than 10,000 or less than 100, an error notification must be displayed. Moreover, the entered amount must be exactly divisible by 100. TEST CASES: If a user inputs an amount less than or equal to 10,000: REMINDER: Maximum amount must only be 10,000 and the minimum amount must not be less than 100 Enter Amount to dispense: 4900The Amount of money you entered is 4900.Do you want to continue your transaction?Enter…arrow_forwardFind the attached file.arrow_forward
- 3.Professor Mysterious uses a special formula to calculate the grade of his students. Write a program that repeatedly does the following: a. Prompt the user to enter the grade of the first test b. Prompt the user to enter the grade of the second test . Prompt the user to enter the grade of the third test. The program should then calculate and displays the student grade based on the following formula: grade-.25*testi+.61 test2+.14 test3 NOTE: Exit the program using sentinel or magic value. SAMPLE PROGRAM RUN Enter Test1 (0 to exit): 100 Enter Test2:90 Enter Test3:87 Grade: 92.08 Enter Test1 (0 to exit): 0 Thank you for using this program.arrow_forward*2. Express the following Boolean expressions in simpler form; that is, use fewer operators. x is an in (d) !(x <= y)arrow_forwardHi! I need help with the Java programming for these 2 questions! Thank you :)arrow_forward
- "### Exercise 1 ###\n", "The table presented below gives a final grade based on the amount of points a student get at the end of the course. Write a program that asks the student for the number of points he got and, based on the number of points the program should print the student's final grade: \n", "\n", " points grade |\n", 11 ] }, }, { ----\n", less than 500 | 0 |\n", between 500 and 550 | 0.5 \n", between 551 and 640 between 641 and 730 between 731 and 800 between 801 and 850 between 851 and 900 between 901 and 960 above 960 "\n", "Use the if-elif-else consditional to solve this problem. \n" "cell_type": "code", 'execution_count": null, "id": "831e820c", "metadata": {}, "outputs": [], "source": [] 1.0 \n", 1.5 \n", 2.0 \n", 2.5 \n", 3.0 \n", 3.5 \n", 4.0 \n", "cell_type": "markdown", "id": "fa947e7e", "metadata": {}, "source": [arrow_forwardWritten in C# Language Please! A fixed percentage of water is taken from a well each day. Request values for W and P where: ▪ W is the amount (in litres) of water in the well at the start of the first day ▪ P is the percentage of the water in the well taken out each day Write a program to print the number of the day, the amount taken for that day and the amount remaining at the end of the day. The output should be terminated when 30 days have been printed or the amount of water remaining is less than 100 litres, whichever comes first. For example, if W = 1000 and P = 10, the output should start as follows: Day Amount Taken Amount Remaining 1 100 900 2 90 810 3 81 729 Note: The amount taken and amount remaining should be displayed to 2 decimal places.arrow_forward10. Given the following variables, for each problem, determine what will be printed on the screen when the code is executed. If there is an error, say what the error is. numl = 4 num2 = 13.0 tf = False if num2 > 5: e. if tf num2 > numl: а. == print ("Big") print ("this tf:", tf) ww" wwww else: else: print ("Small") print ("that tf:", tf) www" b. if numl 5: f. tf = True www print ("Message 1") if tf == num2 > numl: else: print ("this tf:",tf) www print ("Message 2") else: print ("that tf:",tf) www if numl = 5: c. print ("Message 1") g. tf = "True" www else: if tf == num2 > numl: print ("Message 2") print ("this tf:",tf) else: print ("that tf:",tf) www d. if num2 > numl: print ("Tom") if not tf: www print ("Harry")arrow_forward
- 5-Write an algorithm using pseudocode or draw a flowchart for the following problem: You have five different numbers (random numbers). How you can find and print the second maximum number? For instance, suppose the numbers are: 12, 80, 55, 9 and 30. Your algorithm must print 55 as the second maximum number. (10 Marks) e here to search acer F8 F9 F10 F11 F12 Prise F5 F6 F7 F3 Scr Lk Sys & * #3 2$ V 8. 9. T. Y Uarrow_forwardPlease use Visual Studios coding in Python. (Use Python 3 Version)arrow_forwardc#arrow_forward
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning