Write a program using Java to input a number of asterisks to print and a number to put on each line, then print out the asterisks as requested. Go to the next line after all asterisks have been printed.
Q: Write a Java program to take the input of 5 numbers and output the mean (average) and standard…
A: The given is a requirement to write the program in Java programming. The user will enter the 5…
Q: Write a Java program to take input an integer n which is the size of an array and then take input n…
A: Write a Java program to take input an integer n which is the size of an array and then take input n…
Q: Write a java program that takes as its INPUT two integer command-line arguments N and…
A: Here is the detailed explanation of the program
Q: Write a java program which accepts input from user and draw a lines one in blue color and then…
A: Sample Response: //include required packagesimport java.util.Scanner;import java.awt.Color;import…
Q: Write a Java program to generate two random numbers between 0 and 100. After that ask user to…
A: In the main fucntion Randomly generate two numbers print prompt "Enter the sum of the two…
Q: Write a Java program that asks a user to enter the three angles of a triangle. If the sum of three…
A: import java.util.Scanner; class Main { publicstaticvoid main(String[] args) { Scanner sc = new…
Q: Write a Java program that reads a positive integer number N in the range 5<N<8. If N is outside this…
A: JAVA Code: import java.util.*;class NPattern{ // Function to print Alphabet N Patternstatic void…
Q: Write the Java program to prompt the user for a positive integer n greater than 1 (No error check is…
A: Step 1: Prompt and accept n from user. Step 2: Iterate while loop from 1 to n. Step 3: Check whether…
Q: Create a Java program that asks the user to input a student number. The format of the student number…
A: Java Program for the above scenario
Q: Write a Java program to input 20 integer numbers then: a. Calculate and print the sum of all number…
A: PROGRAM EXPLANATION: Import java.util package. Create the main class and define the main method.…
Q: Write a java program that reads even integers from the user (the input stops when an odd number is…
A: PROGRAM CODE: import java.util.*; // import the java utility packagepublic class Main{…
Q: Write a program to simulate flipping 100 coins
A: I have written a Java code that simulates 100 random tosses of coins can calculate the heads &…
Q: Write Java code to repeatedly print each single digit from 9 down to 1 the number of times based…
A: Step 1 : create a driver function Step 2 : create a loop int i = 9 till i >= 1; i-- Step 3 :…
Q: Write a java program that uses the Scanner to ask the user for an integer, but forces the user to…
A: Required: Write a java program that uses the Scanner to ask the user for an integer, but forces…
Q: Write a Java program to take input 10 integers and find the sum of the last digits of all the…
A: Hello student. Warm greetings from my side. Hope you are doing great. I will try my best to answer…
Q: Write a Java program to take a string & a number(N) from the user and print the string made starting…
A: import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc=…
Q: Write a Java program based on the following situations. · Generate two random single-digit…
A: Step 1:- Program Approach:- Use the Math.random() function for random number Use the if-else…
Q: Write a program in Python that uses a 100 kgs on Earth. Convert the Earthweight to the planets…
A: here all value planet weight is given in the question.
Q: Write a Python program that takes a positive integer from the user and prints the number of digits…
A: Python Program for the above problem
Q: Write a Java program that calculates the size of equal pieces in a puzzle board. You are asked to…
A: I have answered the question in step 2.
Q: Write a Java program that takes the user to provide a single character from the alphabet. Print…
A: I give the code in Java along with output and code screenshot
Q: Write a Java program to take 2 non-negative ints, a and b, print their sum, so long as the sum has…
A: Java program to take 2 non negative integers, a and b, print their sum, so long as the sum has the…
Q: Write a java program that uses a Scanner to ask the user for two integers. Call the first number…
A: Required: Write a java program that uses a Scanner to ask the user for two integers. Call the first…
Q: Write a java program that reads a line of input as a sentence and displays: • Only the uppercase…
A: We need to create a Java program that reads a line of input as a sentence and prints- only…
Q: Write a java program An Abundant number is a number for which the sum of its proper factors is…
A: GIVEN:
Q: Write a java program that reads even integers from the user (the input stops when an odd number is…
A: import java.util.Scanner; import Scanner class from util library public static Scanner scan…
Q: Write a program in Java to take input three integers x,y,z and print the value of (x*y) + (y/z) in…
A: Take input 3 integers using Scanner class in JAVA and then calculate the output using the given…
Q: rite a java program that reads a sets of integers and then finds and print the sum of the even and…
A: Required: Write a java program that reads a sets of integers and then finds and print the sum of the…
Q: Write a Java program that can read a number and determine its reverse by using the division and…
A: import java.util.*; public class Main { public static void main (String[]args) { Scanner sc…
Q: Write a java program that reads 2 decimal numbers (x , y) and then calculates and prints the sum of…
A: Required:
Q: Write a java program that read two integer numbers width and height the of a rectangle, the program…
A: Code: import java.util.Scanner;class Main{public static void main(String args[]){ //declaring…
Q: Write a program that reads an integer and displays all its smallest factors in increasing order. For…
A: start input number find smallest factors for(int i=2;i<=num;) { if(num%i==0) {…
Q: Write a program that reads the length and width of a rectangle as integers from the keyboard and…
A: Given: We are given a program that reads input as length and width of a rectangle as integers.…
Q: Write a Java program to read input two integers x,y and then generate a random value either 0 or 1.…
A: Language is one of the most widely used programming language which has been used to create different…
Q: write a program that prints all multiples of 5 between 5 and 50 inclusive and then reads a number…
A: Since you have not mentioned any specific programming language, we will solve this question for you…
Q: Write a java program that read two integer numbers width and height the of a rectangle, the program…
A: Code and sample output of the code is in step2.
Q: Write a JAVA program that asks the user to input the jackets quality in any letter case (HQL for…
A: To solve the above problem, we have used equals methods which is used to compare the content of the…
Q: Write a java program by taking radius of circle, length and breadth of rectangle, side of square and…
A: Write the java program as follows: Declare the required variables for the radius of the circle,…
Q: Write a Java program to prompt the user to enter a test score, the program asks user to input the…
A: import java.util.Scanner; public class Practice7 { public static void main(String[] args) {…
Q: Write a Java Program to take 3 integers(a.b.c) from the user, print "Great Number" if one of b or c…
A: Find greater number, far number or ugly number as per the given condition.
Q: Write a java program that reads from the keyboard the starting positions and constructs the rest of…
A: java program is implemented below
Q: Write a JAVA program that takes input a single line sentence and displays the second word of the…
A: Write a JAVA program that takes input a single line sentence and displays the second word of the…
Q: Write a Java program Write code segments that reads 12-digit card number and display the person's…
A: Algorithm: Start Read 12 digit card number as string Store last character of string in a character…
Q: Write a Java program to print out an upside-down pyramid as below. The program should use loops and…
A: Introduction of the Program: The Java Program takes the levels as input from the user and then the…
Q: Write a Java program to take a string, print a string where for every char in the original, there…
A: Required: Write a Java program to take a string, print a string where for every char in the…
Q: Write a java program to take a double number and then take a integer and i want to Format(round)…
A: Required:- Write a java program to take a double number and then take an integer and I want to…
Q: Write a Java program that reads a positive integer number Z in the range 0 < Z< 10. If Z is outside…
A: Conditional statement: The "if-else" statement is called a conditional statement. The condition of…
Q: Write a program that asks the user to enter two positive integers, the height and length of a…
A: According to the asked question, the solution is given below with a proper explanation.
Q: Write a program that outputs all the integers between 100 and 1000 (inclusive), that are divisible…
A: Approach: create a class inside main method iterate the for loop to check for condition for number…
Write a
Sample Run:
How many Asterisks :49
How many per line: 7
*******
*******
*******
*******
*******
*******
*******
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- OWrite a program that reads data from a file containing integers that ends with -999. Output the numbers that are divisible by 7 Output the numbers that are divisible by 11 Output the numbers that are not divisible by 7 or 11.1. Write a program that asks the user for the name of a file. The program should display only the 3 lines of the file's contents. If the file contains less than 3 lines, it should display the file's entire contents. Use the file: lorem_ipsum.txt to test your program. Comment your source code and describe your code to someone who may be viewing it for the first time. PLACE SCREENSHOTS OF THE PYTHON CODE AND ALL I/O BELOW. Please use Python ProgrammingIn pthon, how can I fix this code so that it changes the word 'language' in the file to test below where the user inputs info? ile=input('Enter a file name : ')string1=input('Enter a string to be replaced : ')string2=input('Enter a string to be added : ')with open(file,'r') as f: data=f.read()data=data.replace(string1,string2)with open(file,'w') as f: f.write(data)f = open(file, "r")print(f.read()) the file is called Problem 2.txt and contains the following text: Python language is incredibly easy to use and learnfor new beginners and newcomers. The python languageis one of the most accessible programming languagesavailable because it has simplified syntax and notcomplicated, which gives more emphasis on naturallanguage. Due to its ease of learning and usage,python codes can be easily written and executed muchfaster than other programming languages. right now, the text just displays: Enter a file name : problem 2.txtEnter a string to be replaced : languageEnter a string…
- I have this code to determin the frequency of characters in a file which I want to make simpler and use namespace std. Thanks. #include <iostream>#include <fstream>#include <string>#include<stdlib.h>#include <stdio.h>#include <stdlib.h> int main(){FILE *in, *out;char ch;int i=0;char c[1000000];in = fopen("input.txt", "r");if (in == NULL) {printf("Cannot open source file.\n");exit(1);}out = fopen("output.txt", "w");if (out == NULL) {printf("Cannot open destination file.\n");exit(1);} int freq[128] = {0}; // stores frequency of characters do {// read each character from input filech = getc(in);c[i]=ch; // increment frequency of the corresponding characterfreq[ch]++; i++; }while (!feof(in)); // print histogram data in the output filefputs("character frequency ", out);//i=i/2; for (int k=0; k <i;k++){if (freq[c[k]] != 0&&c[k]!='\n'){fprintf(out, "\n%c\t\t\t\t%2d", c[k], freq[c[k]]);freq[c[k]]=0;} } fclose(out);fclose(in); return 0;}PYTHON!!!! Write a script named copyFile.py. This script should prompt the user for the names of two text files. The contents of the first file should be input and written to the second file. An example of the program input is shown below: Enter the input file name: copyFrom.txt Enter the output file name: copyTo.txt Output: After running the program, a file named copyTo.txt will be outputted that contains the text from the copyFrom.txt file. The program writes the contents of the first provided file to the second provided file: Test case: Run code to create file, test 1 Input: copyFrom.txt copyTo.txt Custom test: Check contents of test file 1 Test contents: with open('copyFrom.txt', 'r') as g: org_contents = g.read() with open('copyTo.txt', 'r') as f: contents = f.read() assert(org_contents == contents) The program writes the contents of the first file to the second file: Test case: Run code to create file, test 2 Input: .inFile2.txt…This is my min.c int min(int num1, int num2, int num3) { if (num1 < num2) { if (num1 < num3) { return num1; } } else if (num3 < num2) { if (num3 < num1) { return num3; } } else { return num2; } } This is my min.s .file"min.c" .text .globlmin .defmin;.scl2;.type32;.endef .seh_procmin min: pushq%rbp .seh_pushreg%rbp movq%rsp, %rbp .seh_setframe%rbp, 0 .seh_endprologue movl%ecx, 16(%rbp) movl%edx, 24(%rbp) movl%r8d, 32(%rbp) movl16(%rbp), %eax cmpl24(%rbp), %eax jge.L2 movl16(%rbp), %eax cmpl32(%rbp), %eax jge.L3 movl16(%rbp), %eax jmp.L1 .L2: movl32(%rbp), %eax cmpl24(%rbp), %eax jge.L5 movl32(%rbp), %eax cmpl16(%rbp), %eax jge.L3 movl32(%rbp), %eax jmp.L1 .L5: movl24(%rbp), %eax jmp.L1 .L3: .L1: popq%rbp ret .seh_endproc .ident"GCC: (GNU) 11.2.0"
- PYTHON Suppose that a user enters his data. The data should be in the format: [ 'Age\n', '50\n', 'Job\n', 'None\n' ] Labels appearing more than once are permitted, however, only the last value is used. For example [ 'Age\n', '50\n', 'Job\n', 'None\n', 'Age\n', '56\n'] During the reading of the file, the program should print a message to the console stderr 'Warning label Age defined twice. Using last value of 56. Write a python program that checks if users enter their data multiple times. If they do, print a message to the console stderr 'Warning label <name> defined twice. Using last value of <value>.'A text file contains numbers, one number per line, in total 7 lines, i c++ write a code that opens and reads the text file then display in the numbers in ascending order in the console program(you can use ASCII art to make a path that separates each number in ascending order)This code must be in JAVA. Your client owns a bookstore, and they need to process an input file containing the titles of all their books to remove duplicates. Write a program that reads all of the titles from an input file called SamsBookstore.txt and writes them to an output file called SamsDuplicates.txt. When complete, the output file should contain all duplicated titles found in the input file. Create a text file using the following books: And Then It's Spring Baby Bear Sees Blue Beach Feet Jimmy the Greatest! Boot & Shoe Boy & Bot Cat Tale Creepy Carrots! Jimmy the Greatest! Dog in Charge Eggs 1 2 3 Extra Yarn Ganesha's Sweet Tooth Green Happy Like Soccer H.O.R.S.E.: A Game of Basketball and Imagination The Insomniacs Boy & Bot It's a Tiger! Jimmy the Greatest! King Arthur's Very Great Grandson Me and Momma and Big John The Quiet Place Robin Hood Step Gently Out Up, Tall and High Z Is for Moose The Elephant's Friend and Other Tales from…
- C++ with comments please Create a program proj5_3.cpp that would read the content of an input file and write it back to an output file with all the letters "C" changed into "C++". The names of input/output files are entirely up to you. For example the following file content:"C is one of the world's most modern programming languages. There is no language as versatile as C, and C is fun to use."should be changed and saved to another file with the following content:"C++ is one of the world's most modern programming languages. There is no language as versatile as C++, and C++ is fun to use."To read one character from the file you should use the get() function: ifstream inputFile;char next;...inputFile.get(next); Absolutely NO GLOBAL VARIABLES/ARRAYS/OBJECTS ALLOWED for ALL PROBLEMS.please code in python (regular expression) Using any text editor, manually create a file that contains four or five lines with the following format: Username:Firstname:Lastname:Telephone numberWrite a program that will convert such lines to a Lightweight Directory Access Protocol (LDAP) record format as shown below:dn: uid=Username, dc=example, dc=comcn: Firstname Lastnamesn: LastnametelephoneNumber: Telephone numberCan I please get help for this question. There are three files required. 1). Main.cpp #include <iostream>using namespace std; #include "ItemToPurchase.h" int main() { /* Type your code here */ return 0;} 2) ItemToPurchase.cpp #include <iostream>using namespace std; #include "ItemToPurchase.h" /* Type your code here */ 3) ItemToPurchase.h #ifndef ITEM_TO_PURCHASE_H#define ITEM_TO_PURCHASE_H #include <string>using namespace std; /* Type your code here */ #endif