Problem 3. Write a program that will display an n x n box of asterisks, where n is user input. Advanced: Modify your program such that the length and height of the box can be different from each other.
Q: In PYTHON Using one of the loop construct draw: - Twenty vertical lines - Each line of length 150…
A: Introduction The Python turtle library allows you to create and control graphical objects, known as…
Q: Write a program that reads from the user a character ('q' or 'c'). • i the character is 'c', the…
A: Since the programming language is not mentioned, we'll do it in python. The programming methodology…
Q: You have been asked to write a program to play rock-paper-scissors. Your program will ask the user…
A: PROGRAM CODE: import java.io.*;import java.util.*; class Main { public static String…
Q: Python programming : A robot moves in a plane starting from the original point (0,0). The robot can…
A: Initialize variables x and y to 0. These variables represent the current position of the robot on…
Q: Python Programming: You are roaming in a random city and you have lost. You see a sign board and…
A: Introduction: As per the given problem statement, find the way using the street and develop a python…
Q: A palindrome is a word or phrase that is identical when you read from forward or backward, such as…
A: In this question we have to write a PHP based web program which will check for the string palindrome…
Q: The area of a hexagon can be computed using thefollowing formula (s is the length of a side): Write…
A: Since, programming language is not mentioned in the question, we will answer this question in Java…
Q: C++ One way to create a pseudo-random three digit number (and we are including one- and two-digit…
A: Code: #include <iostream>#include <cstdlib>#include <ctime>using namespace std;…
Q: A regular polygon is an n-sided polygon in which all sides are of the same length and all angles…
A: Program: import java.util.Scanner; //define class public class Area { //main method public static…
Q: A particular talent competition has five judges, each of whom awards a score between 0 and 10 to…
A: # copy the code and run it using python3# take care of the syntax while copying the code# if have…
Q: Write a program that reads three edges for a triangle and computes the perimeter if the input is…
A: The following is the program
Q: Write a program that displays two chessboards, as shown in Figure 6.13. Your program should define…
A: Program Approach: Import turtle package Defining the main method Draw the first chessboard Draw the…
Q: ISP- Java Write a program that will output a right triangle based on user specified input height…
A: CODE:- import java.util.*; class Main{ public static void main(String args[]) { int i,j,rows;…
Q: Using Javascript and HTML: An interesting application of computers is drawing graphs and bar charts…
A: <html><head><title>Drawing Graph and Bar Chart</title><script>var…
Q: In this assignment you will write a program that shows the valid moves of chess pieces. Your program…
A: C++ Code : bool isValid(int c[][MAX], int n){ int a[] = { 0, -1, 0, 1 }; int b[] = { 1, 0, -1, 0…
Q: One interesting application of computers is drawing graphs and bar charts. Write a program that…
A: Read 5 numbers and store in array. Iterate from k=0 to k=4 n=arr[k] Iterate from i=1 to i=n…
Q: Write phython code A ball of mass 5kg is located at position m. It is fired vertically upward with…
A: Initialize the constants:Set the acceleration due to Moon's gravity (g_moon) in m/s^2.Set the…
Q: A palindrome is a word or phrase that is identical when you read from forward or backward, such as…
A: Below is the complete solution with explanation in detail for the given about palindrome checker…
Q: positive
A: Introduction Here we will provide a sample of a program where we can rectify whether the result is…
Q: write a program in python Write a program that will allow a student to enter their name and then…
A: In order to solve this first we need to initiate count to 0 and the count the correct answers by…
Q: Easy Program Please answer fast: you will write a program that calculates the area for ANY…
A: Answer the above program are as follows
Q: 1. Write a program that prints your full name. Write a program that prints your full name using…
A: 1.) #include <iostream> using namespace std; int main(){string name;cout<<"Write your…
Q: Write the following function to draw a regular polygon:def drawPolygon(x = 0, y = 0, radius = 50,…
A: Program Plan: • turtle.setup(700, 350, 0, 0) function is used to fix the position and size of the…
Q: The following program loads and displays an image. Complete the draw_lines function to draw a green…
A: You can write the draw_lines function like this way:
Q: Write Python code of a program that reads an integer, and prints the integer if it is a multiple of…
A: code:- # taking the number from user z=int(input("Enter your number : "))# check if number is not…
Q: Using one of the loop construct draw: - Twenty horizontal lines - Each line of length 150 units(or…
A: Here is the editable source code: import turtle # draws the solid line def draw_solid_line(t):…
Q: 1. Write a pyrhon program that prints out a classic hangman stick figure. The program should ask the…
A: Answer :
Q: Write a Python program that takes a number and tells if it is a perfect number or not. [The input…
A: Using python need to write a program which shows whether number is perfect number or not. For…
Q: Write a c++ program to assign passengers seats in an airplane. Assume a small airplane with seat…
A: Program Approach: Define a function named allfilled() with parameter as array. It will check…
Q: 6. A palindrome is a number or text phrase that reads the same backwards or forwards. For example,…
A: PROGRAM INTRODUCTION: Include the required header files. Start the definition of the main function.…
Q: Given a square matrix with the elements 0 or 1, write a program tofind a maximum square submatrix…
A: Program: import java.util.Scanner; public class AKS{public static int[] findLargestBlock(int[][] m){…
Q: Write a program that calculates the equivalent resistance of a circuit. n electrical resistors with…
A: NOTE: - The program is implemented in the C language. EXPLANATION: - Integer[] of resistance to…
Problem 3. Write a program that will display an n x n box of asterisks, where n is user input.
Advanced: Modify your program such that the length and height of the box can be different from each other.
Step by step
Solved in 2 steps with 4 images
- please code in python You place a pawn at the top left corner of an n-by-n chess board, labeled (0,0). For each move, you have a choice: move the pawn down a single space, or move the pawn down one space and right one space. That is, if the pawn is at position (i,j), you can move the pawn to (i+1,j) or (i+1, j+1). Ask the user for the size of a chessboard, n (integer). Find the number of different paths starting from (0,0) that the pawn could take to reach each position on the chess board. For example, there are two different paths the pawn can take to reach (2,1). Look at the diagrams below to convince yourself of this. You can see the four paths that you can take by move 2. Start -> Move 1 -> Move 2 (0,0) -> (1,0) -> (2,1) (0,0) -> (1,0) -> (2,0) (0,0) -> (1,1) -> (2,1) (0,0) -> (1,1) -> (2,2) Print the board with the number of ways to reach each square labeled as shown below. For example: Enter a board size: 4 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is Area = ( n * s2 ) / (4 * tan( π/n) Here, s is the length of a side. Write a program that prompts the user to enter the number of sides and their length of a regular polygon and displays its area.ISP- Java Write a program that will output a right triangle based on user specified input height (int) and specified input symbol (char). The first line will have one user-specified character, such as % or *. Each subsequent line will have one additional user-specified character until the number in the triangle's base reaches specified input height. Output a space after each user-specified character, including after the line's last user-specified character. Hint: Use a nested for loop. Ex: If the input is: Enter a character: * Enter triangle height: 8 the output is: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- Write a program that displays two chessboards, as shown in Figure 6.13. Your program should define at least the following function:# Draw one chessboard whose upper-left corner is at# (startx, starty) and bottom-right corner is at (endx, endy)def drawChessboard(startx, endx, starty, endy):Write a c++ program to assign passengers seats in an airplane. Assume a small airplane with seat numbering as follows: 1 A B C D 2 A B C D 3 A B C D 4 A B C D 5 A B C D 6 A B C D 7 A B C D The program should display the seat pattern, with an 'X' marking the seats already assigned. For example, after seats 1A, 2B, and 4C are taken, the display should look like this: 1 X B C D 2 A X C D 3 A B C D 4 A B X D 5 A B C D 6 A B C D 7 A B C D After displaying the seats available, the program prompts for the seat desired, the user types in a seat, and then the display of available seats is updated. This continues until all seats are filled or until the user signals that the program should end. If the user types in a seat that is already assigned, the program should say that that seat is occupied and ask…Write a program that will display the following pattern.
- Task 9 Write Python code of a program that reads an integer, and prints the integer if it is a multiple of NEITHER 2 NOR 5. For example, 1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39 ... hint(1): use the modulus (%) operator for checking the divisibility hint(2): You can consider the number to be an integer !%3%===== Example01: Input: 3 Output: 3Write a program that calculates the equivalent resistance of a circuit. n electrical resistors with resistance values R1, R2,.., Rn are said to be connected in parallel if the same voltage is applied across each. Their equivalent resistance Reg is related to the values R1, R2, ..., Rn by: 1 1 1 1 + +...+ R R R, R. "eq Write a program that prompts the user to enter the resistance of n resistors. The user should be prompted continuously by using a while loop until a zero or negative value is entered (the program should count the number of resistors n entered by the user and store the values in an array). Use another separate loop to print the resistance values entered by the user and the equivalent resistance Reg. Test your program with R1= 1 kn, R2= 2 kn, R3= 4 kQ and R4= 8 kQ.Given a square matrix with the elements 0 or 1, write a program tofind a maximum square submatrix whose elements are all 1s. Your programshouldprompt the user to enter the number of rows in the matrix. The program then displaysthe location of the first element in the maximum square submatrix and thenumber of rows in the submatrix. Here is a sample run: Enter the number of rows in the matrix: 5 ↵EnterEnter the matrix row by row:1 0 1 0 1 ↵Enter1 1 1 0 1 ↵Enter1 0 1 1 1 ↵Enter1 0 1 1 1 ↵Enter1 0 1 1 1 ↵EnterThe maximum square submatrix is at (2, 2) with size 3 Your program should implement and use the following method to find the maximumsquare submatrix:public static int[] findLargestBlock(int[][] m)The return value is an array that consists of three values. The first two values arethe row and column indices for the first element in the submatrix, and the thirdvalue is the number of the rows in the submatrix.
- Write a program that reads from the user a character ('q' or 'c'). If the character is 'c', the program reads from the user the radius rof a circle and prints its area. • If the user enters 'q', the program asks the user to enter the length and width of a quadrilateral. We assume the quadrilateral is either a square or rectangle. You should print if the quadrilateral is square or rectangle. • Otherwise, it prints "Wrong character" PS: Use the following formulas: area of circle=3.14*r Sample Run1: Enter a character (q or c): q Enter the Length and Width: 80 150 |It is a rectangle Sample Run2: Enter a character (q or c): q Enter the Length and Width: 80 80 It is a square Sample Run3: Enter a character (q or c): c Enter the radius: 2 The area of the circle is 12.56 Sample Run4: Enter a character (q or c): d Wrong characterC-PROGRAMMING: Q1PYTHON PROGRAMMING (practice review for final) (please see attached)