Write a program that asks the user for a rectangle's length and width. Then it prints a rectangle of x's with those dimensions. Use a loop to validate the user's input; in other words, don't let the user enter values smaller than 1. Ex: if the user enters 5 for the length and 3 for the width, the output would look like: length = 5 and width = 3 XXXXX XXXXX XXXXX Note: the length is horizontal, and the width is vertical
Q: Write a program that will print a rectangle outline. Read a height and width from the user and print…
A: #include<iostream>using namespace std;//method to print rectangle outline//takes height and…
Q: Write a java program that uses nested for-loops to display a sequence of numbers. The program should…
A: Program:- import java.util.*;public class Main{ public static void main(String[] args) {…
Q: Write a program that asks the user to enter two positive integers, the height and length of a…
A: Program description: h and l are the user input integer variables that take from the user the values…
Q: Write a program that reads a floating point number and prints "zero" if the number is zero.…
A: """Program will read a floating-point number and print "zero"if the number is zero.Otherwise, print…
Q: Write a program that generates a random number in the range from 1 through 100 After generating the…
A: import random while True: print("Main Menu") print("---------") print("1)Play Game")…
Q: Write a program that prompts the user to input an integer (not a String) and then outputs both the…
A: Note: In this question, the coding language is not specified then we are doing this question in the…
Q: Write a program that reads in a temperature from the keyboard an- prints what type of shirt is…
A: Please find python code in the following step.
Q: Write a Java program that: • Ask user to enter the last two digits of the Student ID number and…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Implement the following: Write a loop that prints out the following numbers. Example Output 100 |…
A: Objective: This program prints a given number series. The series displays every number starting from…
Q: Write a program that draws the following graphic consisting of 50 circles with randomly generated…
A: import javafx.application.Application;import javafx.event.ActionEvent;import…
Q: Write a program that reads from the user two integers of three digits each. The program finds the…
A: import java.util.Scanner;//to readinputpublic class Main{ public static void main(String[] args) {…
Q: Write a program that asks a user to input the height of triangle and draw a triangle that has the…
A: Let Us clarify what exactly will be the output of the below code(In Step-2). So, in output it will…
Q: Write a program that asks the user to enter two integer numbers X and Y. The program halves each…
A: code #include <iostream>using namespace std; int main(){ float x,y; int ctr=0;…
Q: Use a loop to track the growth of the Utopian Tree. The tree grows exactly 1 cm for the first three…
A: Answer is given below-
Q: Write a program in Python with a loop to compute the sum of all odd digits of an input. For example,…
A: """program in Python with a loop to compute the sum of all odd digits of an input""" #ask user to…
Q: Write a program that prompts the user to enter theminutes (e.g., 1 billion), and displays the number…
A: Program code: //IMPORT Scanner class import java.util.Scanner; //define a class NoOfYears public…
Q: Write a program that reads in five integers using loops and then determines and prints the largest…
A: Note: Since the language is not defined in the question, thus the question is answered in C++…
Q: Write a program that uses a Scanner to ask the user for a double. Then write a loop that counts from…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: Write a program that converts a number from binary to decimal. Prompt the user for a binary number…
A: To write a program to convert binary number to decimal number. I used C++ language for coding.
Q: Write a program that implements a tip calculator. Your program should ask the user for the bill…
A: Here no language is mentioned, so i have provided python code for given question.
Q: Write a program that asks the user to enter an integer consisting of 4 digits only, and check how…
A: C programming language is used below to solve the given problem. Algorithm: Start Initialise the…
Q: Write a program that displays an inchworm on the left-hand side of the screen, facing right. Then…
A: According to the information given:- We have to display inchworm on the left side of the screen…
Q: Write a program that asks the user to enter an integer number and checks whether the number is prime…
A: #include <iostream> using namespace std; int main() { int n, i, m=0, flag=0; cout…
Q: Write a program that prompts the user to input an integer (not a String) and then outputs both the…
A: Note: Below is the required program in the C++ language. Program Approach: Including a necessary…
Q: Write a program that asks the user for a number and prints out 2 to the power of that number: Enter…
A: Given Python program to find 2^n.
Q: Write a java program that uses nested for-loops to display a sequence of numbers. The program should…
A: Code: import java.util.Scanner; public class MainClass { public static void main(String[] args) {…
Q: Write a program that prints a grocery receipt of items purchased.
A: The Given program is to print a grocery receipt
Q: Q: Write a program in python that asks the user to enter a string, then prints out each letter of…
A: Note :- for better execution program use online IDE . In online IDE , if you get any…
Q: Write a program in Python, in which the user can enter any number of positive and negative integer…
A: print("Counting the number of positive and negative values entered by the user!\n") positive =…
Q: rting with the following code, add a loop that will prompt the user for the number of math questions…
A: Program Approach: 1- As mentioned in the assignment prompt a message and add a loop. 2- In the…
Q: Use a loop to print the alphabet from A to Z. Print all the characters in one line, with no spaces…
A: Java Program to print the the uppercase letters from A to Z, and a second line for the lowercase…
Q: Write a program to find the first n numbers of the Fibonacci series. You have to take a positive…
A: function printFibonacciNumbers(int n): Start declare f1 = 0,f2 = 1,i if n < 1 then return…
Q: Write a program that asks a user to input the height of triangle and draw a triangle that has the…
A: I give the code in Java along with output and code screenshot
Q: Write a program that prompts the user to enter apoint (x, y) and checks whether the point is within…
A: Program Approach: Importing necessary packages to get standard input and output. Defining a class…
Q: Write a program in Java that asks the user for a positive nonzero integer value. The program should…
A:
Q: Write a program that compares the area of two rectangles. You can do this several ways, one way is…
A: The program is written in Python. Please find the program in step 2.
Q: Write a program that asks the user to enter a series of single- digit numbers with nothing…
A: number=int(input())l=[]while(number>0): remainder=int(number%10) l.append(remainder)…
Q: Write a program that asks a user to input the height of triangle and draw a triangle that has the…
A: Nested Loop: C allows loops to be nested. Nesting of loops is a C feature that allows statements to…
Q: A square is divided into four smaller regions as shown in (a). If you throw a dart into the square…
A: Python program is given below:
Q: Write a program that asks the user to enter an integer number and checks whether the number is prime…
A: Please find the answer below :
Q: Write a Python program that will ask the user to input a word, will return the first letter of the…
A: Given: Write a Python program that will ask the user to input a word, will return the first letter…
Q: Write a program (Lab8_ex4_ld.py) that generates a random even positive integer less than 10 and…
A: Python code is given below with comment for better understanding.
Q: rite a program to compute the sum of the first N Fibonacci numbers, where N is an integer that is…
A: Define module java.util.* for basic operations. Define main class. Define function func with…
Q: Write a program that asks the user for the price of several items sold until the user answers with…
A: logic:- use while True to iterate infinite time read value check if value==‘N’…
Q: a program that simulates flipping a coin to make decisions. The input is how many decisions are…
A: heads_or_tails() input 1 TypeError: heads_or_tails() missing 1 required positional argument:…
Q: Write a program to find two points that are nearest to each other. For example, points (1, 1) and…
A: I have added the comments. I have also added the screenshot. The class name is Test. So the commands…
Q: Write a program that asks the user for an animal sound, then prints out that sound twice on the same…
A: the answer is given below:-
Hi, I need to solve this problem with C++
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images
- Write a program that plays a simple dice game between the computer and the user. When the program runs, a loop should repeat 5 times. Each iteration of the loop should do the following: Generate a random integer in the range of 1 through 6. This is the value of the computer’s die. Ask from user an integer in the range of 1 through 6. This is the value of the user’s die. The die with the highest value wins. (In case of a tie, there is no winner for that particular roll of the dice.) You need to validate the input if it’s correct or not. As the loop iterates, the program should keep count of the number of times the computer wins, and the number of times that the user wins. After the loop performs all of its iterations, the program should display who was the grand winner, the computer or the user.In PYTHON Using one of the loop construct draw:- Twenty vertical lines- Each line of length 150 units(or pixels)- All lines aligned at the same top horizontal margin - Lines 10 units apart each other Note- The first line and all lines in odd positions(e.g. 1, 3, 5, etc.)should besolid lines- The second line and all lines in even positions(e.g. 2, 4, 6, etc.)should be dashed lines - - Set the length of solid segment to 10 units - - Set the length of the non-visible segment to 5 units Assumption- Use of Turtle libraryWrite a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number. Program should count and display number of tries to win the game. (Use for loop to solve the problem) Python program
- Please solve this using java Write an application that allows a user to enter the names and birth dates of up to 10 friends. Continue to prompt the user for names and birth-dates until the user enters the sentinel value “ZZZ” for a name or has entered 10 names, whichever comes first. When the user is finished entering names, produce a count of how many names were entered, and then display the names. In a loop, continuously ask the user to type one of the names and display the corresponding birth-date or an error message if the name has not been previously entered. The loop continues until the user enters “ZZZ” for a name.Write a program in Java A hotel’s occupancy rate is calculated as follows:Occupancy rate = Number of rooms occupied / Total number of rooms Write a program that calculates the occupancy rate for each floor of a hotel. The programshould start by asking for the number of floors in the hotel. A loop should then iterate oncefor each floor. During each iteration, the loop should ask the user for the number of roomson the floor and the number of them that are occupied. After all the iterations, the programshould display the number of rooms the hotel has, the number of them that are occupied,the number that are vacant, and the occupancy rate for the hotel.Input Validation: Do not accept a value less than 1 for the number of floors. Do not accepta number less than 10 for the number of rooms on a floorPrimeAA.java Write a program that will tell a user if their number is prime or not. Your code will need to run in a loop (possibly many loops) so that the user can continue to check numbers. A prime is a number that is only divisible by itself and the number 1. This means your code should loop through each value between 1 and the number entered to see if it’s a divisor. If you only check for a small handful of numbers (such as 2, 3, and 5), you will lose most of the credit for this project. Include a try/catch to catch input mismatches and include a custom exception to catch negative values. If the user enters 0, the program should end. Not only will you tell the user if their number is prime or not, you must also print the divisors to the screen (if they exist) on the same line as shown below AND give a count of how many divisors there are. See examples below. Your program should run the test case exactly as it appears below, and should work on any other case in general. Output…
- Write a program that generates a random number in the range from 1 through 100 After generating the random number, the user is to guess the number. If the user’s guess is higher than the random number, the program should display “Too high, try again” If user’s guess is lower than the random number, the program should display “Too low, try again”. If the user guesses the number, the program should congratulate the user and then generate a NEW random number so the game can start over. Make the game menu driven with these options Main Menu ______________ 1)Play Game 2)Exit written in pythonWrite a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high. Try again.” If the user’s guess is lower than the random number, the program should display “Too low. Try again.” The program should use a loop that repeats until the user correctly guesses the random number. Then the program should display “Congratulations. You figured out my number.”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.
- 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 the user for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month. After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period. Add additional loops to validate the input: Do not accept a number less than 1 for the number of years. Continue to prompt the user for a number until a valid number is entered. Do not accept negative numbers for the monthly rainfall. Continue to prompt the user for a number until a valid number is enteredWrite a program that calculates the occupancy rate for a hotel. The program shouldstart by asking the user how many floors the hotel has. A loop should then iterate oncefor each floor. In each iteration, the loop should ask the user for the number of roomson the floor and how many of them are occupied.After all the iterations, the program should display how many rooms the hotel has, howmany of them are occupied, how many are unoccupied, and the percentage of roomsthat are occupied.The percentage may be calculated by dividing the number of rooms occupied by thenumber of rooms and then multiplying by one hundred.write a program in python Write a program that will allow a student to enter their name and then ask them to solve 10 mathematical equations. The program should display two random numbers that are to be added, such as: 247 + 129 The program should allow the student to enter the answer. The program should then display whether their answer was right or wrong, and accumulate the right values. After the 10 questions are asked, calculate the average that was correct. Then display the student name, the number correct, and the average correct in both decimal and percentage format. In addition to any system functions you may use, you might consider the following functions: A function that allows the student to enter their name. A function that gets two random numbers, anywhere from 1 to 500. A function that displays the equation and asks the user to enter their answer. A function that checks to see if the answer is correct and accumulates the number correct. A function that calculates the…