1) to stop entering new values. The while entered by the user is not -1. Example output: Enter miles driven(-1 to quit): 287 Enter gallons used: 13 Miles per gallon is 22.07 Enter miles driven(-1) to quit: -1|
Q: Write a program that prints the first few verses of the traveling song "One Hundred Bottles of…
A: Here, I have to write a java solution to the above question.
Q: With the statement, With the statement, int grade=198; int grade=100;…
A: The output of the first question is an Invalid grade. The output of the second question is an…
Q: The boy scouts' popcorn supplies are all over the place and troops are only receiving certain…
A: Python used to answer this question
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 asks the user to enter today’s sales for five stores. The program should then…
A: Following is the c++ program that takes as input from user sales of five stores and display the…
Q: Write a program that prints the numbers from 1 to 100, except if the number is divisible by 3 print…
A:
Q: Answer the ff looping problems- WHILE LOOP 1. Allow the user to input integer values and sum up…
A: The Jаvа while lоор is used tо iterаte а раrt оf the рrоgrаm reрeаtedly until the…
Q: Write a program that asks the user to enter the amount that he or she has budgeted for a month. A…
A: As there is no programming language mentioned so question is attempted in python language. enter…
Q: Write a program that uses for loops to perform the following steps: Prompt the user to input two…
A: THe answer is..
Q: Write pseudocode that prints out 3 offices, with 5 employees each. You must use a nested loop. Your…
A: Note :- You have not mention the language of the program for output , so i'm answering your question…
Q: Using Python to write a program with a loop that asks the user to enter a series of positive…
A: Algorithm: Start Initialize total to 0 Iterate through the loop Ask user to enter a number If…
Q: There are 6 employees. Write a program with nested loops, to ask the yearly salary of each employee…
A: In this program, you need to take user input for salary of 6 employees for 5 years. After taking…
Q: Use C language in this program
A: Here I have created a function named gcd(). Inside the function, I have created the condition to…
Q: A mail order house sells five different products whose retail prices are: product 1: $2.98 product…
A: C++ used to answer this question
Q: Write a program that prompts the user to enter an integer number n, and outputs the terms of a…
A: The problem is about use of loops to print the sequence genrated by dividing the firtsly number and…
Q: Write a program that generates a random number between 1 and 100 and asks the user to guess what the…
A: Lets see the solution.
Q: Write a program that calculates the balance of a savings account at the end of a three- month…
A: Program code: #include <iostream> using namespace std; //…
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 uses nested loops to collect data and calculate the average rainfall over a…
A: #include<iostream> using namespace std; int main(){ int numberOfYears=0, totalRainfall=0;…
Q: In this program you will use a nested loop to generate the following outputs: $ ./a.out 1 22 333…
A: Hello student Greetings Hope you are doing great. Thank You!!!
Q: Write a program that will print the message “Computer Science is cool!!” 10 times. Use a while loop.…
A: As there is no programming language mentioned so program is attempted in c++ language 1. Write a…
Q: Write a software called Digits that asks the user for a positive integer, then reverses the number…
A: PROGRAM INTRODUCTION: Include the required header files. Declare and initialize the required global…
Q: Design a VI in LabVIEW to display the sum of first 'n' numbers using for loop, e.g., if user enters…
A: here in this question we will develop program which will accept number from user and then it will…
Q: Task 2: Multiples Write a program that asks the user for an integer n, and then prints fırst 10…
A: The problem is based on the basics of while loop in programming languages. NOTE: The solution is in…
Q: Write some code that uses a while loop to get 10 integers from the user, one at a time. When all…
A: Given: Write some code that uses a while loop to get 10 integers from the user, one at a time. When…
Q: Write a program that uses a while loop to enter any number of positive integers. When the loop ends,…
A: Given: Write a program that uses a while loop to enter any number of positive integers. When the…
Q: Write a program that calculates a student's GPA. Ask the user to enter grade and also the credit…
A: Sample Response: //C++ program to calculate and print the GPA#include <iostream>using…
Q: For example, if a vehicle travels 40 miles per hour for 3 hours, the distance traveled is 120 miles.…
A: Algorithm 1. Start 2. Var hour, speed, distance=0 3. Accept a non zero positive input as hours from…
Q: Write a program that asks the user to enter the amount that he or she has budgeted for a month. A…
A: The javascript code is embedded in the HTML page using the script tag. Take monthly budget as input…
Q: This program will resemble a comp appl that is used to show the largest value in a series well for…
A: The program is solved in c++ as the programing language in the question is not provided. Below is…
Q: Write a program that calculates the occupancy rate of the 120 suites (20 per floor) located on the…
A: Program code: #include <iostream> using namespace std; int main() { const int OCC = 120;…
Q: Write a program that displays a weekly payroll report. A loop in the program should ask the user for…
A: Answer: The program has shown below- #include<iostream> #include<stdlib.h> using…
Q: Write a Basic program to calculate Y value if the condition (Y <0) break the loop and Y equation as…
A: Algorithm: Start Read n value Initialize x and d to 1 Initialize y to 0 Calculate…
Q: Write a program that allows the user to enter a series of exam scores. The number of scores the user…
A:
Q: Given the code: int x; cout > x; Write a loop to print all numbers from 1 to x inclusive that are…
A: We have to find the numbers who are not the factors of X. Read x. for i = 1 check if n%i is not…
Q: Write a software called Digits that asks the user for a positive integer, then reverses the number…
A: Because no programming language is mentioned here. As a result, we're offering a Java-based…
Q: Write a program that allows the user to enter a series of exam scores. The number of scores the user…
A: Following is the python program to calculate the average of a series of exam scores: Approach:…
Q: Write a program that generates a random number and asks the user to guess what the num- ber is. If…
A: C++ Code: #include <iostream> using namespace std; int main(){ int num, guess, tries = 0;…
Q: Write a program that uses a for loop to display a table that lists in one column values for ounces,…
A: - We have to code for printing the table for ounces, pints, quartz and litres.
Q: Write a program in Python that sums a series of (positive) integers entered by the user, excluding…
A: Use a while loop to iterate and here we check whether to enter loop or not based on the input value…
Q: Write a program that requests the current time and a waiting time as two integers for the number of…
A: Given that, Write a program that requests the current time and a waiting time as two integers for…
Q: Write a program that will predict the size of a population of organisms. The program should ask the…
A: PROGRAMING CODE: #include <iostream>#include <iomanip>using namespace std; int main(){…
Q: Write a program that asks the user to enter today’s sales for five stores. The program should then…
A: To solve this program following variables, data types and methods are used to calculate the sell…
Q: A tennis club , which currently charges $150 per month for membership, has told the members that…
A: #note no programming language is mentioned so i was used c++ programming language…
Q: Write a program that calculates the balance of a savings account at the end of a three- month…
A: Actually, program is an executable software that runs on a computer.
Q: Modify the given program to only accept an arrow head width that is larger than the arrow base…
A: /* Program after modification */ import java.util.*; //Main function public class Main{ public…
Q: Write a program Digits that prompts the user to input a positive integer and then outputs the number…
A: Since, here no programming language is specified. So, we are providing the solution in Java. The…
Q: each of the expenses (zero indicates the user is done with entering an expense) for the month and…
A: CODE:- import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Write a complete program that: 1. Uses a do...while loop to prompt the user to enter a count that is…
A: Answer :
Write a
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- 1. Prompt the user and read in the number of a team playing the current game, i.e. Team 1, Team 2, Team 3, etc. 2. Prompt the user and read in the number of the opponent team. It is probably helpful to think of the first team as the home team for this game, and the second team as the away team. 3. Prompt the user and read in a team’s score for the current game. Use the team’s number when asking for the score in your printf statement. 4. Prompt the user and read in the opponent’s score for that game. Again, use the opponent’s team number when asking for the score. 5. Notify the user and repeat steps 3 and 4 in the case that the user enters a negative value. 6. Calculate the points earned by each team and add it to a cumulative score. A win is worth 3 points, a draw is worth 1 point and a loss is zero points. Also update the amount of games played by each team and their goals for and against. 7. Print to the screen the following header and beneath it a line of data that corresponds to…units = int(input(" Please enter Number of Units you Consumed : ")) if(units < 50): amount = units * 2.60 surcharge = 25 elif(units <= 100): amount = 130 + ((units - 50) * 3.25) surcharge = 35 elif(units <= 200): amount = 130 + 162.50 + ((units - 100) * 5.26) surcharge = 45 else: amount = 130 + 162.50 + 526 + ((units - 200) * 8.45) surcharge = 75 total = amount + surcharge print("\nElectricity Bill = %.2f" %total) Find the error and resolve the problem.3. B) What is the value of num when the following code snippet runs successfully? int num = 100; if (num < 100) { if (num < 50) { num -= 5; } else { num -= 10; } } else { if (num > 150) { num += 5; } else { num += 10; } } C) A store provides 10 percent discount on all items with a price of at least $100. No discount is otherwise applicable. Assume that two variables are declared, discount and price. Write the code segment that does the job.
- please trace the following statements: (both variable and output trace). for (i = 1; i <=2; i++)for (j = 1; j <= 2; j++){value = i + j + 10;cout << value << endl;} I J Value OutputPrint "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 3 if user_num2 is greater than 13. Otherwise, print "user_num2 is less than or equal to 13.". End with newline.Medium-sized universities have enrollments in the range 9500 - 21500 inclusive. Write an if statement that outputs "Medium-sized university" if the input numStudents is in this range. Otherwise, output "Not a medium-sized university". End the output with a newline #include <iostream>using namespace std; int main(){ int numStudents; cin >> numStudents; /* Your code goes here */ return 0;}
- Print "user_num1 is negative." if user_num1 is less than 0. End with newline. Assign user_num2 with 1 if user_num2 is greater than 12. Otherwise, print "user_num2 is less than or equal to 12.". End with newline. My code: user_num1 = int(input())user_num2 = int(input()) if user_num1 < 0: print("user_num1 is negative.") if user_num2 > 12: user_num2 == 1 else: print("user_num2 is less than or equal to 12.") print('user_num2 is', user_num2) When the input is 0 and 13 my output for user_num2 is 13 and it should be 1. I don't know what I'm doing wrong.Puma Filling Station sells gasoline and has a car wash. Fees for the car wash are K40.00 with a gasoline purchase of K200.00 or more and K70.00 otherwise. Three kinds of gasoline are available: regular at K16.25, unleaded at K 17.63, and super unleaded at K 19.50 per litter. You are required to write a program that prints a statement for a customer. Input consists of number of litters purchased, kind of gasoline purchased (R, U, S, or for no purchase, N), and car wash desired (Y or N). Develop a Pseudocode and a structure chart for the service station problem.The following returns ______ when passed the argument 3. int example(int n){ if (n == 0) return 0; else return example(n – 1) + n * n;}
- 1.20 LAB: Expression for calories burned during workout The following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('Men: {:.2f} calories'.format(calories_man))Assume that you have price distributions as follows: (000 - 299 $), (300 - 599 $), (600 - 899 $), (900 $). Write a program asking the user to enter the number of occurrences of the above distribution, and represent that as STARS “*” for each occurrence in front of each distribution. Note: 1- Use printf to format each distribution automatically as you learned before. 2- If the nu ber occurrences distribution is more than 50, the program should write the word “BINGO! “.Assume that you have price distributions as follows: (000 - 299 $), (300 – 599 $),(600 – 899 $), (900 $).Write a program asking the user to enter the number of occurrences of the abovedistribution, and represent that as STARS “*” for each occurrence in front of eachdistribution. Note:1- Use printf to format each distribution automatically as you learned before.2- If the number of occurrencesfor a distribution is more than 50, the programshould write the word “BINGO!”.