Write a small program that asks the user how many asterisks it should print out. The user responds with a number, then the program prints that number of asterisks. The number of asterisks to print should be stored in a variable. Finally the program asks the user if it should start over, and repeats as many times as the user wants. The prompt to run the program again should look like the one below, and should wait at the end of the line for the user input.
Do you want go again? (y/n):
From this assignment on, all programs must include a student header. The student header showing who wrote it, the Course Name(CS Intro to blah, blah), The Course Registration Number, the modification date, and the assignment name. This is called your student header.
For example, each of my programs must include a block of comments at the top like this below where the labels (a word followed by a colon with no spaces in between):
// Name: Johnson
// Course: programming
// CRN: 30134
// Date: 5/20/2015
// Assignment: Asterisks
Note: Could you plz go this code and let me know if
u need any changes in this.Thank You
_________________
// DisplayAsterisks.java
//Name:
//Course: programming
//CRN: 30134
//Date: 2/05/2019
//Assignment: Asterisks
import java.util.Scanner;
public class DisplayAsterisks {
public static void main(String[] args) {
int num;
/*
* Creating an Scanner class object
which is used to get the inputs
* entered by the user
*/
Scanner sc = new
Scanner(System.in);
while(true)
{
System.out.print("\nEnter No of Asterisks :");
num=sc.nextInt();
System.out.println("Displaying Asterisks:");
for(int
i=0;i<num;i++)
{
System.out.print("* ");
}
System.out.println();
System.out.print("Do you want go again? (y/n):");
char
ch=sc.next(".").charAt(0);
if(ch=='Y'||ch=='y')
continue;
else
{
System.out.println(":: Program Exit ::");
break;
}
}
}
}
_______________________
Output:
Enter No of Asterisks :10
Displaying Asterisks:
* * * * * * * * * *
Do you want go again? (y/n):y
Enter No of Asterisks :5
Displaying Asterisks:
* * * * *
Do you want go again? (y/n):n
:: Program Exit ::
_______________Could you plz rate me well.Thank
You
Write a small program that asks the user how many asterisks it should print out. The...
IN PYTHON Write a program that asks the user for the name of a file . The program should display the contents of any file with each line preceded with a line number followed by a colon. The line number should start at 1
Write a PYTHON program that asks the user for the name of the file. The program should write the contents of this input file to an output file. In the output file, each line should be preceded with a line number followed by a colon. The output file will have the same name as the input filename, preceded by “ln” (for linenumbers). Be sure to use Try/except to catch all exceptions. For example, when prompted, if the user specifies “sampleprogram.py”...
Write a java program that asks the user to enter an integer. The program should then print all squares less than the number entered by the user. For example, if the user enters 120, the program should display 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.
Write a program that asks the user for a student name and asks for grades until the user enters a non-number input, it should then ask if the user wants to enter another student, and keep doing the process until the user stops adding students. The student’s must be stored in a dictionary with their names as the keys and grades in a list. The program should then iterate over the dictionary elements producing the min, max, and mean of...
Python assignment: Write a program that asks for the user's age. Based on their response print "You can vote" (18 years old or older) or "You can't vote" and also whether or not he/she is a senior citizen (over 64). If senior citizen print "You're a Senior Citizen...you deserve two votes"! Use the Idle editor and don't forget the .py extension. Good luck. Your python program will be graded on the following: Execution of the program gives the correct...
Write a program that asks for 'name from the user and then asks for a number and stores the two in a dictionary [called the_dicr) as key-value pair. The program then asks if the user wants to enter more data [More data ly/n]?) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list Note: Ignore the case where the name is already...
Write a program that prompts the user for an integer that the player (maybe the user, maybe someone else) will try to guess. If the player's guess is higher than the target number, the program should display "too high" If the user's guess is lower than the target number, the program should display "too low" The program should use a loop that repeats until the user correctly guesses the number. Then the program should print how many guesses it took....
Solve Question using While loops-MATLAB Write 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.
Write a program that asks the user for the name of an image, the name of an output file. Your program should then save the upper right quarter of the image to the output file specified by the user. A sample run of your program should look like: Enter image file name: hunterLogo.png Enter output file: logOUR.png which would have as input and output: HUNTER ITER The City University of New York Hint: See sample programs from Lectures 3 and...
Write a program that asks the user for the number of cats and the number of dogs registered in a course, storing the number of cats and dogs each in a variable. Print the percentage of cats in the course followed by a space and then print the percentage of dogs in the course. Example: Suppose there are 8 cats and 12 dogs. There are 20 total animals in the class. The percentage of cats can be calculated as 100*(8...