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. 1 Cooking oil 2 Curry powder RM 3.40 3 Detergent 4 Potato chips RM 2.50 RM 8.50 RM 3.20
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: 3. Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer.…
A: The Answer is in given below steps
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 uses loops to collect data and calculate the average score over a number of…
A: Answer : TextWindow.Write("Enter number of students(1-10): ") nStudents = TextWindow.Read()…
Q: compare loans with various interest rates) Write a programthat lets the user enter the loan amount…
A: By given problem, it is to be desired to display the user different loan amounts according to the…
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 will simulate the NJ Cash 5 lottery. The purpose of this exercise is to…
A: .net file link https://drive.google.com/file/d/1A3mwSSAh-O_zxxAa7RM1bGqCaNrZyNCF/view you can edit…
Q: Assume that you want to generate a table of multiples of any given number. Write a program that…
A: The answer given as below:
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: By using while loop Co.while loop, write a program that displays a list of groceries. Then, allow…
A: (1)First read the number of products (2)Loop to read each product (3)Compute the price of each…
Q: Assighme Heads or Tails? It is said that a perfectly fair coin will return heads 50% of the time,…
A: heads or tails :
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: 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: 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: JAVA CODE PLS THANK YOU 4. A Shorter Three by CodeChum Admin Numbers in threes are awesome! But…
A: Java Code: public class Main{ public static void main(String args[]) { for (int i=1;…
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 that uses nested loops to collect data and calculate the average rainfall over a…
A: The C++ program is written for rainfall calculation using the nested loop where it takes the input…
Q: Write a program that reads two excel sheets. One of these sheets contains a list of items names. The…
A: CODE: # Import library to read excel fileimport openpyxl # Reading the sheets in the…
Q: Given the code that reads a list of integers, complete the number_guess() function, which should…
A: Program approach: # TODO: Import the random module import random # TODO: Get a random number…
Q: We are given 5 integer numbers. Write a program that checks if the sum of some subset of them is 0.…
A: - We need to highlight the code for subset.
Q: Write a program that calculates the amount of money a person would earn over a period of time if the…
A: Algorithm : Step 1 : declare variables. Step 2 : create object of scanner class to take input. Step…
Q: Write a program that will simulate the NJ Cash 5 lottery.
A: Program in python: import random #Initialise an empty list that will be used to store the 5 lucky…
Q: Task 1 Write a Python program that will ask the user to input a string (containing exactly one…
A: # As per our guidelines we are supposed to answer only one question. Kindly repost other questions…
Q: In Coral Programing!! Write a program that takes in an integer in the range 20-98 as input. The…
A: Read an integer as input. Check if the integer is between “20” and “98”. If yes, move on to next…
Q: Write a program that prints all letters that occur a single time in a string. For example, if the…
A: To write a java program that prints all characters that occur a single time in a string
Q: Implement the following: 1) Use a loop to print all the numbers of multiples of 6 and multiples of…
A: #include<iostream> using namespace std;int findSum(int a, int b){ int sum = 0; for (int…
Q: Write a program, using a while loop, that reads 5 items, item1, item2, item3...5, from the keyboard…
A: Logic:- define a list called item=[] iterate from i=0 to i<5 read value from user and append…
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: By using while loop OR do..while loop, write a program that displays a list of groceries. Then,…
A: Programming language is missing in the question. So we will answer this program in C++ language. If…
Q: Sentinel Using the while'sentinel approach, write a program that will read a line and print that…
A: Task : Complete the given Java code to print the expected output. Java Program :- import…
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: 3. The following is a list of customers' annual scores. The company decided that to each customer…
A: According to the provided information: We need to create a program that can identify the customers…
Q: Write a program that calculates the amount of money a person would earn over a period of time I f…
A: According to the information given:- We have to follow the instruction in order to get the desired…
Q: Using a loop, extend the program to handle multiple lines of input. Continue until the user enters q…
A: import java.util.Scanner;public class Main{public static void main(String[] args) { String…
Q: Given the code that reads a list of integers, complete the number_guess() function, which should…
A: Program code: #import randomimport random#define function to guess the numberdef…
Q: Q1/ Write a program that reads from the user the number of students in the class and their grades i…
A: Code:Specific language is not mentioned so i am giving the code in c++ langauge: #include…
Q: OUTPUT CONSOLE Please insert number of students: 5 Please insert Student l's mark: 20 Please insert…
A: Note: Answering the question in python as no programming language is mentioned. Input : Input…
Q: int index = 0; do{ if(numbers[index]%2 == 1) System.out.println(numbers[index]+" is…
A: Please find the answer below :
Q: This following program is intended to print something sensible. .ORIG LEA R1, ? A ADD R1, R1, -2 B…
A: The OUT instruction prints something that is in R0 To print the string, the label should be I at ?…
Q: Assign sum_extra with the total extra credit received given list test_grades. Full credit is 100, so…
A: Approach Use a for-each loop to check each score that is greater than or less than 100 using if…
Q: Given the following program segment: int i;int value = 3;for (i = 0; i < 5; i++)value = value *…
A: Given program: #include <iostream> using namespace std; int main() { int i; int value = 3;…
Q: The factorial of n (written n!) is the product of the integers between 1 and n. Thus 4! = 1*2*3*4 =…
A: We have write java programming user for a non-negative integer and computes and prints the factorial…
in c++
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- Assignment Write a program that tracks how much steps the user walks in total in a day and reports if the daily target is reached or not. The program will keep reading double values, each representing steps walked during an individual activity within a day (stepsWalked) until either the user enters a negative value or the daily target of 5000 steps is met. If the user enters a negative number, the program should print total steps walked as a double. Otherwise, if the target is exactly reached, the program should simply print "Target is reached", finally if the target is surpassed the program should print the text "Target is surpassed by", followed by the excess amount above the target as a double, and finally printing the text "steps". NOTE: You MUST use a repetitive statement in this question. NOTE: Each stepsWalked value will be given as a non-negative value. You do NOT need to check this. Input Output Answer assignment 3000 1300 500 2305.2 Target is surpassed by 2105.2 steps 450…Task 1: Find the even multiples of any number chosen by the user in a given range - the user should specify the multiples of which number they want to print and a minimum and maximum value. The multiples printed should be within the [minimum, maximum] range. For example, if the user chooses the number 7 and would like to print all even multiples in the [15, 60] range, the program should print all the even multiples that are bigger than or equal to 15 (minimum), but smaller than or equal to 60 (maximum). The program should keep a count of how many numbers were printed and should output that count, as well as the numbers. The output then, for the example given, should be 28, 42, 56, and the count should be 3. Shell scriptingA retail company assigns a $5000 store bonus if monthly sales are more than $100,000; otherwise a $500 store bonus is awarded. Additionally, they are doing away with the previous day off program and now using a percent of sales increase to determine if employees get individual bonuses. If sales increased by at least 4% then all employees get a $50 bonus. If they do not, then individual bonuses are 0. Step 7: The final step in completing the pseudocode is to call all the modules with the proper arguments. Complete the missing lines. Module main () //Declare local variables Declare Real monthlySales Declare Real storeAmount Declare Real empAmount Declare Real salesIncrease //Function calls Call getSales(monthlySales) Call getIncrease(salesIncrease) Call ______________(_______________, _____________) Call ______________(_______________, _____________) Call ______________(_______________, _____________) End Module
- Problem: A small company needs an interactive program to compute an employee’s paycheck. The payroll clerk will initially input the data, and given the input data, an employee's wage for the week should be displayed on the screen for the payroll check. The data for the employee includes the employee's hourly pay rate and the number of hours worked that week. Wage is equal to the employee's pay rate times the number of hours worked (up to 40 hours). If the employee worked more than 40 hours, wage is equal to the employee's pay rate times 40 hours plus 1½ times the employee's pay rate times the number of hours worked above 40. Instructions: Match the action at the left-side with the correct step number at the right-side (the attached picture). Note that it may be possible to group more than one related actions in the same logical step / process without altering the essence of the algorithm. In the program flow, input and checking of hourly pay rate should come before that of the number…Question#2. The distance a vehicle travels can be calculated as fallout: Distance = Speed * Time For example, if a train travels 60 miles-per-hour for three hours, the distance [raveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles-per-hour) and the number of hours it has traveled. It should use a loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph far a three-hour time period, it should display a report similar to the one chat follows: Hour Distance Traveled 1 90 2 100 3 150 Input Validation: Do not accept a negative number for speed and do not accept any value les than 1 for time traveled.Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate twelve times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After alliterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.
- Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints1 ≤ T ≤ 1001 ≤ X, Y ≤ 1031 ≤ Z ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…Birthday party At Lili's birthday party, there was a game arranged by Jojo as the host. That game is to distribute Y number of candy to X number of people where all the candy tastes sweet except for one last candy which tasted like rotten nuts. Candy distribution will be sequentially starting from position Z and if past the last position then the distribution of candy continues to the first position. Write down the person in which position will get the last candy. Input FormatThe first line of input is T, which is the number of test cases.The second row and the next number of T rows are X, Y, Z.X is the number of people to whom the candy will be distributed.Y is the number of candy available.Z is the starting position of the person to whom the candy will be distributed. Output FormatA string “Case #N: “ and a number representing the position of the person who got the last candy. Constraints? ≤ ? ≤ ???? ≤ ?, ? ≤ ???? ≤ ? ≤ X Sample Input 43 4 13 5 24 2 24 5 2 Sample OutputCase #1: 1Case…Basic while loop expression. Write a while loop that prints userNum divided by 4 (integer division) until reaching 2 or less. Follow each number by a space. Example output for userNum = 160:40 10 2 Note: These activities may test code with different test values. This activity will perform four tests, with userNum = 160, then with userNum = 8, then with userNum = 0, then with userNum = -1. See "How to Use zyBooks".Also note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.
- Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the student with the highest score (display the student’s name and score). Also calculate the average score and indicate by how much the highest score differs from the average. Use a for loop. Test Data: Ben Simmons 70 Carson Wentz 80 Joel Embiid 90 Bryce Harper 75 Redo Problem A. Replace the for loop with a while loop0199% 10:00 docs.google.com/forms 13 last constant Problem 1 At a certain university, students have to submit their exams online. The administration decides that for each minute of late submission, 5 points are deducted. Write a program that asks the user for his initial grade and how long he delayed in submitting, and then displays the final result. Sample Run 1: Enter your initial grade: 82 Enter the late submission time (in minutes) : 6 Your final grade is 52 Sample Run 2: Enter your initial grade: 115 Grades should be between 0 and 100 Sample Run 3: Enter your initial grade: 43 Enter the late submission time (in minutes): 10 Your final grade is 0 Sample Run 4: Enter your initial grade: 72 Enter the late submission time (in minutes) : -2 Time should be positive Your answer Problem 2 Write a Java program integers day. month, and vear. You are NOT required to check if the values entered by the user are in give the user the ability to determine the day of a given date. The user shall…(Statistics) This is the formula for the standard normal deviate, z, used in statistical applications: z=(X)/ X is a single value. refers to an average value. refers to a standard deviation. Using this formula, you need to write a program that calculates and displays the value of the standard normal deviate when X=85.3,=80,and=4. a. For this programming problem, how many outputs are required? b. How many inputs does this problem have? c. Determine a formula for converting input items into output items. d. Test the formula written for Exercise 7c, using the data given in the problem.