Which loop (while, do-while, or for) is best to use in the following situations?
A) The user must enter a set of exactly 14 numbers.
B) A menu must be displayed for the user to make a selection.
C) A calculation must be made an unknown number of times (maybe even no times).
D) A series of numbers must be entered by the user, terminated by a sentinel value.
E) A series of values must be entered. The user specifies exactly how many.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out With C++: Early Objects (10th Edition)
Additional Engineering Textbook Solutions
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Management Information Systems: Managing The Digital Firm (16th Edition)
SURVEY OF OPERATING SYSTEMS
Starting Out with Python (4th Edition)
Starting Out With Visual Basic (8th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- A for statement is a loop that goes through a list of things. Therefore, it keeps running as long as there are objects to process. Is this a true or a false statement?arrow_forwardDirection: Perform what is asked below. CASE: Due to the present situation that we are facing, which is the pandemic, the government decided to limit the type of rice the consumer can purchase to one. With your help as a programmer, the government ask you to create such program. The program should be able to display the menu as displayed below. The user will be allowed to enter the choice, quantity in kilo grams (kg) and payment amount. The program should also be able to output the total amount due and the change. Organize your algorithm in such a way that it is logically correct, usable and functional. RICE MENU [1] Denorado [2] [3] Jasmine [4] NFA [5] Malagkit Senandomeng Organic Brown Rice P55/kg P47 /kg P58/kg P38 /kg P70/kg P120/kgarrow_forwardThe condition that controls a Do While loop must be true for the loop to be executed. Checkboxes are used in designing the user interface for situations where the user may choose only one of a few choices. Boolean variables are often used to improve the readability / clarity of the program code. For Next loops can have both negative and positive step values. If no item has been selected in a listbox, the SelectedIndex property of the listbox will have a value of zero. A Boolean variable must be initialized after the If instruction in which it is used is executed. A post-test loop is a loop that is designed to be executed at least once. In coding a Select Case instruction, the only thing that may appear after the Select Case keywords is a variable. A Do loop begins with the keyword Do and ends with the keyword Loop. The condition that controls a Do Until loop must be true for the loop to be executed. Radio buttons are used in designing the user interface for situations where the user…arrow_forward
- * Question Completion Status: Moving to another question will save this response. Quèstion 5 Simplified form of F=y +x y+y xz is xy + y + x Z xy + y (1 + y z) xy +y (x+y z) xy +y +xz A Moving to another question will save this response.arrow_forwardhomework help please solvearrow_forwardRemaining Time: 54 minutes, 49 seconds. * Question Completion Status: QUESTION 19 Write a Java program that prompts the user to enter the School Grade Level of a student and then calculate their discount amount in the regular fees structure offered during this pandemic situation. By using the below table, calculate their discount amount from the amount of the regular fee and then print the discount amount in OMR by using the appropriate selection structure. (Assume the user is entering a maximum Grade level is 12) discount amount = Regular Fees * percentage of discount rate School Grade Level Regular Fees in OMR Discount Rate >9 and 6 and 3 and 0 and <=3 30.500 5% otherwise 20.400 No discount T T T Arial 3 (12pt) v T -E E- 只i ン Click Save and Submit to save and submit. Click Save All Answers to save all answers. Save All Answers TOSHIBA F5 F6 F7 F8 F9 F10 F11 F12 INS SCNULL LOCK AD & 67 7 V 8A9 4 0arrow_forward
- MULTIPLE CHOICE -The answer is one of the options below please solve carefully and circle the correct option Please write clear .arrow_forwardwrite codesarrow_forwardIn Lab 2, you created a menu for a simple calculator program. In this lab, you will add some functionality to the menu. Also, it is important to let the user know if they entered an invalid choice. Write a program (or modify the one written for Lab 2) that displays the following menu and prompts the user for a selection. Once the selection has been made, display the selection back to the user. Then, ask the user for two numbers and perform the selected operation (+, -, *, /). Display the results back to the user (e.g. 2 + 3 = 5). When dividing, display an error message if the second number (denominator) is 0. 1) Add two numbers 2) Subtract two numbers 3) Multiply two numbers 4) Divide two numbers 9) Exit program The program should: contain header comments as shown in class display a "hello" message before presenting the menu display the menu prompt the user for selection display the selection back to the user if the selection was invalid, display error message to user and then go…arrow_forward
- Slide Type Slide Exercise # 3: Write a program that first asks the user to type today's price for one dollar in Japanese yen, then reads US dollar values and converts each to yen. Use 0 as a sentinel. • The following are sample runs of the program. Slide Type Enter today's price in yens for 1 $: 105.69 Enter amount in dollars to convert: (0 to quit) 200 200.00 dollars = 21138.00 yens Enter amount in dollars to convert: (0 to quit) 500 500.00 dollars = 52845.00 yens Enter amount in dollars to convert: (0 to quit) 100 100.00 dollars = 10569.00 yens Enter amount in dollars to convert: (0 to quit) e Slide Type Enter today's price in yens for 1 $: 105.6 Enter amount in dollars to convert: (0 to quit) e Slide Type # Exercises # 3 Source Codearrow_forwardCasel: Write a menu driven program that allows you to visit cities ofman in random order with following options.1: Visit a city2: Go to previous city3: Quit theprogramWhen user presses 1: program asks user to enter the city name, andthen display that the city has been visited. Please note user can visit acity any number of timesWhen user presses 2: Program takes you back to the previous cityWhen user presses 3: Program terminatesSee the below example how program interacts with the user:C:> 1: Visit a cityprogramEnter your choice2: Go to previous city3: Quit thePlease enter a city to visit.MuscatYou are in Muscat now.Enter your choice.1: Visit a city2: Go to previous cityPlease enter a city to visit.IbraYou are in Ibra noW.Enter your choice.1: Visit a city2: Go to previous cityPlease enter a city to visit.SoharYou are in Sohar now.Enter your choice.1: Visit a city2You are in Ibra now.2: Go to previous cityEnter your choice.1: Visit a city2: Go to previous cityPlease enter a city to…arrow_forwardExamine the following while loops and determine the value of ires at the end of each of the loops, and the number of times each loop executes. (a) ires = 1; while mod (ires, 15) = 0 iresires + 1; end ires = number of times ires = 3; while ires 100 iresires^2; end ires = number of times (b) (c)arrow_forward
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning