Write a java program that read two integer numbers width and height the of a rectangle, the program should draw a rectangle using stars (*) where width determine the number of stars in top an bottom sides and height determine the number of stars in the left and right sides.
Q: JAVA: Write a program that reads an integer and prints how many digits the number has, by checking…
A: Given: Write a program that reads an integer and prints how many digits the number has, by checking…
Q: Write a program that displays the classic BINGO game, displays a BINGO card (5x5 square), and tests…
A: The Java program is given in the steps below.
Q: Write a Java program PrintTriangle, to print a triangle. Ask the user, how many rows you want in…
A: import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=…
Q: Write a Java program that prompts the user to enter the x and y coordinates of the three vertices of…
A: Introduction: Program Design Prompt user for inputs and use Scanner object to read the inputs into…
Q: 6. Write a Java program that reads the length of a scale in inches and then prints the equivalent…
A: Write a Java program that reads the length of a scale in inches and then prints the equivalent…
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 complete Java program that reads a line of keyboard inputcontaining two values of type…
A: The program includes instructions for solving the problems and outputs the results. The program's…
Q: Write a Java code to get the velocity of efflux of water flowing from a hole at a height h from…
A: Required:- Write a Java code to get the velocity of efflux of water flowing from a hole at a height…
Q: Write a Java program that prompts the user to enter a line of text and outputs the number of digits,…
A: Let us say that the line of text be taken input in a string s. We have to find the number of digits,…
Q: Write a Java Program to take 3 integens from the user, one of them is small, one is medium and one…
A: Write a Java Program to take 3 integers from the user, one of them is small, one is medium and one…
Q: Write a java program to find the distance travelled by a car by taking the speed and time
A: As given, I need to write a Java program that takes speed and time as input and find distance. The…
Q: Write a Java program that gets a string from the user and reports whether or not there are repeated…
A: In main a while loop is used to ask for user input of a character. If character equals a then…
Q: Write a Java program that displays employees information and their salary. There are two types of…
A: Salary of Part-time employee is calculated as: If working hours are less than or equal to 40 then…
Q: How would I do this program? I am stuck.
A: Program DesignPrompt user for inputs and use Scanner object to read the inputs into double…
Q: Write a complete Java program that asks the user to input the radius (r) and the height (h) of a…
A: Please find the answer below :
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 that computes the sum of two rational numbers given by the user. [Note: If two…
A: Here have to determine about java code for sum of rational numbers.
Q: Write a java program that ask the user to enter number of days in the month, then reads the daily…
A: logic:- read value of n iterate from I=0 to I<n Read values in array arr. end loop set…
Q: Write a Java program that reads an integer, which represents a year, and determines and prints…
A: logic here:- // if the InputYear is multiple of 4 if (InputYear % 4 == 0) { // if the…
Q: Write a Java program to read the distance between two points (in Kilometer) and time to travel…
A: The program is written in Java. Please find the Source code in the next step.
Q: Write a java program to take three ints, a b c, print true if b is greater than a, and c is greater…
A: Java Program for above : import java.util.Scanner; class Prog{ public static void main…
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: In this java project, you are asked to write a program for a Pizza store to process pizza orders.…
A: Given: In this java project, you are asked to write a program for a Pizza store to process pizza…
Q: Write a Java program that computes the sum of two rational numbers given by the user. [Note: If two…
A: I have provided java code to find the sum of two rational numbers.
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 that prompts the user to enter two positive integers and find their greatest…
A: Java code: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Write a Java program that reads two positive integers num1 and num2 (assume num1 < num2). Then, the…
A: A perfect number is one whose sum of factors (except the number itself) is equal to the number. In…
Q: Write a Java program which allow user to enter a number that represents repetition. Then, the user…
A: In this question, we are writing a java program which calculate the average of numbers and count how…
Q: Write a Java program that reads a double and prints "zero" if the number is zero. Otherwise, print…
A: Here there is two different programs given so I have provided answer for code 1 with output.
Q: Write a java program to find the area of square, rectangle and circle using the method over loading.…
A: Required:- Write a Java program to find the area of a square, rectangle, and circle using the method…
Q: Write a Java program that print out its own text.
A:
Q: Write a java program where a user enters and stores the average monthly rainfall figures (int) for…
A: import java.util.ArrayList;import java.util.Scanner; public class TownRainfall{ public double…
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 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 that computes the product of odd numbers that are in the range [a, b] where a…
A: The question is on writing a Java program that computes the product of odd numbers that are in the…
Q: Write a Java program that prints rectangles of three different sizes to the screen, with a blank…
A: Answer the above program are as follows:
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: Create a Java program that will display the first 40 pentagonal numbers. Hint: A pentagonal number…
A: Java program to display the first 40 pentagonal numbers. The formula to calculate the pentagonal…
Q: Write a Java program that asks a user to enter a time of the day (integer number from 0 to 24). If…
A: The java if-else statement also tests the condition.It executes the if block if condition is true…
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 program in Java to find the sum of even and odd number between two numbers by getting the…
A: We need to write a Java language program that takes the input of two numbers from the user and…
Q: Write a java program that asks the user to enter an integer from 20 to 99 in numeric…
A: Given Write a java program that asks the user to enter an integer from 20 to 99 in numeric form. The…
Q: Write a Java program that keeps a number from the user and generates an integer between 1 and 7 and…
A:
Q: Write a java program to find the number of vowels, consonents, digits and white space characters in…
A: Import the util. Scanner package. Inside main() function create Scanner class object. Prompt user…
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 java program to find the batting average of user taken total runs, user inputted number of…
A: start input total runs , number of innings , notout calculate batting average…
Q: In Java: Write a program with total change amount in pennies as an integer input, and output the…
A: Program import java.util.*; public class Main { public static void main(String [] args) {…
Step by step
Solved in 2 steps with 1 images
- Create a simple java program that reads all the content in a .txt file, the user will enter the filename to be opened. In this case, the file will contain multiple lines of student details with each line containing a single student detail. Your task is to then create a student class that models the firstname, lastname, year of birth and gender of every student. The student class should further be able to assign every student created with a student number using a class variable[format is 2022000X, X is a number such as 1,2..] and be able to calculate the age of each student. Within the driver class add all the students read from file into an ArrayList and then print the first and last student in the list. You are additionally expected to deal with most common exceptionsWrite a program that will read the file text.txt which is provided and the encryptedmessage in there. Please write back the decrypted message into the output.txt file.When you see the message in the output.txt file, you need to submit the java codefile. You need to use Rot13 class for decrypting the message. Do not need to submit in the output.txt file. file example: public class FileExample { public static void main(String[]args){ try {//create file object for input.txtFile in_file = new File("src/input.txt");//create file object for output.txtFile out_file = new File("src/output.txt"); //read the input.txt file with ScannerScanner read = new Scanner(in_file);//write the output.txt file with PrintWriterPrintWriter w = new PrintWriter(out_file); while(read.hasNextLine()){w.write(read.nextLine());} //don't forget to closew.close(); // while(scan.hasNext()){// System.out.println(scan.next());// } }catch(Exception ex){ex.getStackTrace();}Write a program in Java to perform the following: Using a BufferedReader class and related objects, read a string object consists of 60 words plus some special characters and numbers. Include double space between some words. Include a few $ and % signs in your text. Store that text into a file using proper classes and methods. Call that file fileon.doc which will be your input file then read the contents of that file and perform the following operations using java available methods: Add a new line at the beginning of the text to include your name and the class name (csc 202) Find the length of you text Change the first character of each line to upper case . Find the number and location of all $ sign and re place it with a space. Delete all double spaces Calculate the number of special characters Find the number of lines in your text. Remember each line is terminated by a “.”, find the number of vowel in the last line Count the number of digits in your text. Append a new line consist…
- Write a Java Program The local Kids’ League coach keeps some of the baseball team statistics in a text fileorganized as follows: each line of the file contains the name of the player followedby a list of symbols indicating what happened on each at bat for the player. Theletter h indicates a hit, o an out, w a walk, and s a sacrifice fly. Each item on theline is separated by a comma. There are no blank spaces except in the player name.So, for example the file could look as follows:Willy Wonk,o,o,h,o,o,o,o,h,w,o,o,o,o,s,h,o,hSam Slugger,h,h,o,s,w,w,h,w,o,o,o,h,sIn this problem you will a create a program that reads raw data from a text file andprints properly formatted statistics. For instance, a sample output for the firstplayer in the example:Statistics for Willy Wonk:Hits: 4Outs: 11Walks: 1Sacrifices: 1Batting Average: 0.267.1. Create a text file “stats.txt” containing the data below:Willy Wonk,o,o,h,o,o,o,o,h,w,o,o,o,o,s,h,o,hShari Jones,h,o,o,s,s,h,o,o,o,h,o,o,o,oBarry…Write a JAVA program that reads the student information from a tab separated values (tsv) file. The program then creates a text file that records the course grades of the students. Each row of the tsv file contains the Last Name, First Name, Midterm1 score, Midterm2 score, and the Final score of a student. A sample of the student information is provided in StudentInfo.tsv. Assume the number of students is at least 1 and at most 20. Assume also the last names and first names do not contain whitespaces. The program performs the following tasks: Read the file name of the tsv file from the user. Open the tsv file and read the student information. Compute the average exam score of each student. Assign a letter grade to each student based on the average exam score in the following scale: A: 90 =< x B: 80 =< x < 90 C: 70 =< x < 80 D: 60 =< x < 70 F: x < 60 Compute the average of each exam. Output the last names, first names, exam scores, and letter grades of the…Java: Below are 3 java files along with a text file. Make sure in the console, shank.txt is read into tokens. Make sure to show the 3 java files with the screenshot of shank.txt being printed out in the console. The output must show shank.txt being printed out in tokens. There must be no error at all. Main.java import java.io.IOException;import java.nio.file.Files;import java.nio.file.Paths;import java.util.List; public class Shank { public static void main(String[] args) { if (args.length != 1) { System.out.println("Error: Exactly one argument is required."); System.exit(0); } String filename = args[0]; try { List<String> lines = Files.readAllLines(Paths.get(filename)); Lexer lexer = new Lexer(); for (String line : lines) { try { List<Token> tokens = lexer.lex(line); for (Token token : tokens) { System.out.println(token); } } catch (Exception e) { System.out.println("Exception: " + e.getMessage()); } } }…
- In Java The following is a java code for an old word puzzle: “Name a common word, besides tremendous,stupendous and horrendous, that ends in dous.” If you think about this for a while, it will probablycome to you. However, we can also solve this puzzle by reading a text file of English words andoutputting the word if it contains “dous” at the end. The text file “words.txt” contains 87314English words, including the word that completes the puzzle. This file is available on Moodle.Your job is to insert try-catch statement in the below code, such that you surround the “risky” APIwith an appropriate exception handler --Edit the code if you have to!// import IO and util packages.public class WordPuzzle{public static void main(String[] args){String s;Scanner scanner = new Scanner(Paths.get("words.txt"));while (scanner.hasNext()) { String word = scanner.next(); if (word.endsWith("dous")) System.out.println(word); } // end while} // end main} // end classWrite a Java program, GradeApp that reads a series of exam scores given as integers in the range 0 to 100. Display the total number of grades and the number of grades in each letter-grade category, followed class average (as a percentage with 2 decimal place): Use the value -1 as a sentinel value to indicate the end of the input. (The -1 value is used only to end the loop. Please do not use it in the calculations.)Write a Java program that uses the coordinates.txt file in your project directory. Each line of this file contains a pair of coordinates. Read every line, find out the Euclidean Distance between the two coordinates in every line, and save the distance of every line in a file called “outputs.txt”. Bonus: From your outputs.txt file, find out the maximum distance and print it out in the console. Algorithm: For each line in coordinates.txt: split line with “ ”. This should separate out the two points. split each of the two points with comma. This gives you x1,y1 and x2,y2 calculate the Euclidean Distance according to the formula shown in the class append this distance in a new line in your outputs.txt file.-------------------------------------------------------------------------------- coordinates.txt 1,2 3,62,4 2,56,2 3,81,4 6,28,2 5,53,5 3,74,6 2,64,7 2,51,8 3,68,3 6,34,8 1,62,5 2,62,8 9,35,8 3,83,7 0,20,3 8,14,7 2,52,7 9,21,9 9,14,7 1,6
- Using Java 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 Ancient India. The Goldilocks Variations The Great Race: An Indonesian Trickster Tale King Arthur's Very Great Grandson Hans My Hedgehog: A Tale from the Brothers Grimm. Paul Bunyan and Babe the Blue Ox: The Great Pancake Adventure Robin Hood The Town Mouse and the Country Mouse: An Aesop Fable. The Wooden Sword: A Jewish Folktale from Afghanistan.Create a java program that calculates the average test scores. Given the student’s name and five test scores, calculate the test scores. The student’s name, five test scores and the average test score is stored in the file testaverage.txt. The data is input from the file test.txt. Sample Run Input file (Contents of the file test.txt) Andrew Miller 87.50 89 65.75 37 98.5 Output file (Contents of the testaverage.txt) Student Name: Andrew Miller Test Scores: 87.50 89.00 65.75 37.00 98.50 Average test score: 75.75Write a Java program in a file called Box.java that outputs a box of stars (*) on the screen. Prompt the user for how big (row x column) the box should be. For example: Please enter the size of the box (row column): 3 4 **** **** ****