By using while loop OR do..while loop, write a program that displays a list of groceries. Then, allow user to insert number of product that they want to buy, the item's code and quantity for each item. Finally, display the total price that the user needs to pay. Valid input for the number of product and quantity is positive number. Meanwhile valid number for items' code is only from 1 to 4.
Q: Question 2 Take an input from the user if input is between 1-10, print all Odd numbers from 1-50 by…
A: NOTE:- Always mention programming language name . This is done in python. algorithm:- (I) take a…
Q: Q#1: Write a program that prints the numbers from 1 to 1000 On the same line it should also print…
A: The problem is based on the basics of loops in python programming language.
Q: Write a loop that displays a table of angle measures along with their sine and cosine values. Assume…
A: According to the Question below the Complete Program: Program Output:
Q: Write a program that calculates the occupancy rate for a hotel. The program should start by asking…
A: Answer: Executable Code: n = int(input("Floors on the hotel: "))occupied = 0unoccupied = 0totalRooms…
Q: Write a program that uses a loop to ask the user for a number, then to print the first 10 multiples…
A: #include <iostream>#include<conio.h>using namespace std;int main(){ int n,i,t;…
Q: OUTPUT CONSOLE Please insert number of students: 5 Please insert Student 1's mark: 20 Please insert…
A: Input : Input marks Output : Average marks of students.
Q: Write a program that will continually ask the user to enter a positive number from standard input…
A: Type casting is a feature to convert the type of variable from one datatype to another. There are…
Q: Q1/ Write a program that reads from the user the number of students in the class and their grades in…
A: Note: As no language is mentioned, therefore answering in python Input : Number of students Grade…
Q: /Write a program that reads in a series of integer numbers, and determines how many positive odd…
A: Solution: Note: Since it is not mentioned in which language the program should be written so i…
Q: Write a program that prompts the user to enter a series of strings, but with each string containing…
A: So the concept is to start a while loop with initial condition as while(true) and keep on iterating…
Q: Complete the missing parts of the below loop so that it correctly prints out the numbers from 1 to…
A: In given question, we have to complete the given java code which will print 1 to 5. while loop will…
Q: Write a program that allows the user to enter the last names of five candidates in a local election…
A: Actually, program is a executable software that runs on a computer.
Q: Write a program that reads in a series of integer numbers, and determines how many positive odd…
A: Declare two integer-type numbers one for reading input and another for counting the number of…
Q: Assume that you want to generate a table of multiples of any given number. Write a program that…
A: Answer:
Q: Java
A: The program declares two variables Parts and Chapters for user input. Parts take number of parts in…
Q: The tuition for a private university is X riyals this year. Tuition fee increases 5% every year.…
A: The Answer is
Q: Take input numbers from user and find sum of all those input numbers until user inputs negative…
A: The code is written below in c language : #include <stdio.h> #include <conio.h> void…
Q: Write a program that produce first 10 integers in Descending order using While Loop.
A: Loop statement: A loop statement repeats a set of statements until a specified condition or test is…
Q: Only authorized shareholders are allowed to attend a stockholders’ meeting. Write a program to read…
A: #include<iostream>#include<string.h> using namespace std; int main(){ int n,k=0;…
Q: Write a program that: 1. Reads in a number: numStar 2. Prints a row of (*) that is numStar long,…
A: C code for above : #include<stdio.h> int main(){ //declarations int numStar;…
Q: JAVA program Write a while loop that prints all the even numbers from 1 to 100 (inclusive). and…
A: Even numbers from 1 to 100 public class evennumbers { public static void main(String[]…
Q: 5. Write a program that reads 3 items, item1, item2, item3, from the keyboard a. if 1 and 2 are the…
A: I give the code as per your requirement along with output and code screenshot in python
Q: Loops, C++ Write a program whose input is two integers, and whose output is the first integer and…
A: I give the code in C++ along with output and code screenshots
Q: Write a program that calculates how much a person earns in a month if the salary is one penny the…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED C++ FOR THE SOLUTION. Define…
Q: Implement the following: Write a loop that prints out the following numbers. Make sure to precisely…
A: Since you have not mentioned the programming language in which you need this to be done. so i have…
Q: Write a program to sum the numbers from 1 to 10 with increment 0.5 by using while loop
A: def solve(): sum = 0 i = 0 cnt = 1 while i < 10: if i == int(i):…
Q: A word is called as a good word if all the letters of the word are distinct. That is, all the…
A: Actually, python is a easiest programming language. It has a concise(less) code.
Q: There is an interesting sequence of numbers called the Fibonacci Numbers. The set begins with 0 and…
A: In the given question, we are required to generate the Fibonacci series and display the first 20…
Q: Write a program to get a random number between 1 and 100, use the button to check whether the given…
A: write a program to get random number between 1 and 100......
Q: Write a program that generates a random number and asks the user to guess what the number is. If the…
A: Given: Write a program that generates a random number and asks the user to guess what the number is.…
Q: Write a program that asks the user for two integers; assume the second integer is larger than the…
A: Since no programming language is mentioned, I am using python Algorithm: Start Read 2 numbers…
Q: Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q…
A: Please find the answer below :
Q: Write a program that checks to see if the user won the lottery. Assume the winning lottery numbers…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Store the given…
Q: Using nested looping techniques and ONLY the tools we learned in the chapters, write a program that…
A:
Q: Write a program that uses nested loops to display the triangle pattern shown below. + +++ +++++…
A: Code//Header Files#include<iostream>using namespace std;// start main int main (){int i, j;for…
Q: Develop a program that inputs a number from the user using for loop. It display number if its…
A: In the c program, include the necessary libraries and create the main function to perform the…
Q: You have to write a program to find the largest number and its place. For example, if the values are…
A: The following are steps needs to be taken for the given Python program: In the function, findMax()…
Q: Using While Loop in Java Create a program that let the user input ten (10) positive integers. Then,…
A: Algorithm Start Var a[10], count[3] Initialize count array to 0 i=0 while(i<10), go to step 6…
Q: Write a program that gets integer input from user until the user gives a value bigger than 50 by…
A: import java.util.Scanner;public class Upto50 { public static void main(String[] args) {…
Q: Write a program that generates a random number between 1 and 500 and asks the user to guess what the…
A: C++ Program: #include <iostream>#include<cstdlib> using namespace std; //Main…
Q: I am having trouble with coding this in the assignment into python. It is attached as a image
A: The python code with explanation and sample output is given below: - Explanation: - Defining the…
Q: Write a do .. loop for the random number dice problem from Chap Three. Add a counter variable that…
A: import java.util.Random; public class Main{ public static void main(String[] args) { int ctr =…
Q: By using while loop Co.while loop, write a program that displays a list of groceries. Then, allow…
A: The following question is asking to create a menu-driven program for a grocery shop. Compiling the…
Q: int index = 0; do{ if(numbers[index]%2 == 1) System.out.println(numbers[index]+" is…
A: Please find the answer below :
Q: write a while loop that prints that number doubled without reaching 200. Follow each number with a…
A: Given positive integer numInsects, write a while loop that prints that number doubled without…
Q: Exercise # 2: Write a while loop that prints all positive numbers that are divisible by 10 and less…
A: Below is the required code in C++ language. Approach of Program: Include necessary header files…
Q: Write a program to read student ID and check whether it is odd/even number. Output a 4X4 badge if…
A: Note - As you haven't mentioned specific programming language to write code in, I have written the…
Q: Convert the following for loop to a while loop? for ( int x-50; x>0; x-) cout <<x << " seconds to…
A: #include <iostream> using namespace std; int main() { for(int x=50;x>0;x--) {…
Q: Write a program that inputs your student number and printout your Biography when the student number…
A: In this code, our goal is to add the details of a student and user enter a student id, check whether…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- compare loans with various interest rates) Write a programthat lets the user enter the loan amount and loan period in number of years anddisplays the monthly and total payments for each interest rate starting from 5% to10%, with an increment of 1/4. Here is a sample run: Loan Amount: 10000Number of Years: 5Interest Rate Monthly Payment Total Payment5.000% 188.71 11322.745.250% 189.86 11391.595.500% 191.01 11460.70...9.750% 211.24 12674.5510.000% 212.47 12748.23Not sure how to do this question: Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5506014020075100the output is: 506075The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. Such functionality is common on sites like Amazon, where a user can filter results. Your code must define and call the following two functions:def get_user_values()def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold) Utilizing functions will help to make your main very clean and intuitive.Loops, C++ Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last.
- The for loop in (a) is converted into the while loop in (b). What is wrong? Correct it. (java language) (a) int sum = 0; for (int i = 0; i < 4; i++) { if (i % 3 == 0) continue; sum += i; } (b) int i = 0, sum = 0; while (i < 4) { if (i % 3 == 0) continue; sum += i; i++; }(Use Dev C++) Write a program that reads a list of scores between 0 and 100 and finds and prints the smallest and the largest scores. The program needs to ask for the number of the scores from the user; thisnumber must be less than or equal to 10Consider again a list of fridge temperatures that should be kept within a certain range, as described in Question 9. Write a program that prints the percentage of readings that are outside the allowed range (0 to 5 degrees Celsius), as shown in the examples below. Note that the percentage is printed as an integer, rounded down, and that there is a space before the percentage sign. You need to decompose this problem into sub-problems and instantiate and combine the corresponding patterns. If you need to compute the length or sum of a list, you may use the list operations len() and sum() instead of programming them from scratch using the counting and aggregator patterns. Use variable names appropriate to the problem at hand instead of the generic names used by the patterns. Use the get_input() operation to get the input list. For example: Input Result [5, 4, 3, 2, -1, 0] 16 % of values are outside the range [4.7, 5.2] 50 % of values are outside the range…
- write a program to create a vending machine. the program should display at least 5 items, ask the person to choose items, check availability of items if the item is available then request payment, check the payment---- is it enough or not--- if not then ask for more, update quantity give changes of money if required then return to the items list. If the item is not available then also return it to the list. and print out the total sales and total number of item sold ( C++ Object-oriented programming) (use C++ class , struct, vector, etc ) payment in USD $Below is an IPO program which allows the user to find out how many Euros she will get for a given number of dollars. Sometimes, the user enters an invalid value, like $30. Use validation along with the loop-and-a-half sentinel pattern to complete this problem.Write a program that asks user to input their first name. • Use for loop to print each letter of the first name • Additionally, the program should count number of letters in the name and should print 'number of letters in your first name is 7' (Sabrina) use the functions len() and print(f'....)
- One interesting application of computers is drawing graphs and bar charts.Write a program that prompts the user to enter 5 integers, and then outputs abar chart consisting of asterisks. The number of asterisks in each line of thebar chart must be equal to the number the user entered. You may assume theuser will enter only positive integers or 0. C++ please.Write a program that finds the factorials of integers from 1 to 5. Write the results in the form of a table. Do the programming in C language. Thanks.A word is called as a good word if all the letters of the word are distinct. That is, all the letters of the word are different from each other letter. Else, the word is called as a bad word. This can be continued based on the user input is 'Y'.