Below is a program written in java. In a separate word document, go through the program line by line and describe what each line does. Also describe what the output of the code will be when it is executed. 2 public class Unit03Assignment01 public static void main(String[]args) { // create a variable for the radius of a circle and for the value of pi int radius = 5; double pi = 3.14; %3D %3D // calculate the circumference of a circle: circumference = 2 * pi * radius double circumference = 2 * pi * radius; // Write out the message as a string String message = "The circumference of a circle with radius " + radius + + circumference; // send the message to the console System.out.printIn(message); } 16
Q: Write a Java program that reads two positive integers num1 and num2 (assume num1 < num2). Then, the…
A: I give the code in Java along with output and code screenshots.
Q: Write a Java program that reads two positive integers num1 and num2 (assume num1 < num2). Then, the…
A: Here we need to define a separate method to find whether a number is perfect or not. Let it called…
Q: 21. Consider the following method: public static void sketch(int x1, int y1, int x2, int y2, int n)…
A: Given method call: sketch(a, 0, -a, 0, 2) x1=a y1=0 x2=-a y2=0 n<=0 i.e 2<=0 (False)…
Q: public class array { public static void main(String args[] {…
A: ArrayIndexOutOfBoundsException
Q: Write a Java program called IntCheck that examines the integer variable x, printing GT (greater…
A: Firstly, you need to identify that it is a command line argument program
Q: Write the Java program: Make sure to have proper code indentation. Code: class Main { public…
A: class Tile{ char letter; int value; //Constructor Tile(char l, int v) {…
Q: Create a Java program that will read a date (month, day and year) in integer form and display the…
A: Simple Date Format is a concrete class for formatting and parsing dates in a locale-sensitive…
Q: Evaluate the JAVA code snippet below, then motivate why this is representative of good programming…
A: Good programming practices: The given code snippet is not an example of good programming practice…
Q: Scanner inputDevice = new Scanner(System.in); System.out.print("Enter an integer: "); int number =…
A: Java is an object-oriented programming language, it will be used to build web applications and also…
Q: Exercise 2: A. Write static methods: public static double cubeVolume(double h) : h3 public static…
A: The Java OOPS code to do the job described in problem statement is: Part A) Keeping cube, Cylinder…
Q: What is the number of operations executed when the following Java code runs? Your answer is expected…
A: public class AddThree { public static void main(String[] args) { Stdout.print("Type the first…
Q: Write a java program: Using a single print() method [i.e., System.out.print()], create output of…
A: public class Main{ public static void main(String[] args) { System.out.print("The Irish Colonel"+…
Q: Write a complete Java program that prints out the following information: Ask the user to enter the…
A: The main objective of the java program, Rabab.java is to prompt the user to enter the last three…
Q: of her graduation photo. The ladder is placed at 2 feet away from the wall. The angle that is formed…
A: Let consider the given data and construct a triangle as shown below:
Q: Write a Java program with a class named Introduction that prints: 1. Your name. 2. A blank line. 3.…
A: Java programming: Java is a class-based, object-oriented general-purpose programming language. The…
Q: IN JAVA please not python In this game, one fly and three frogs are placed randomly on a…
A: You are going to write a simulation for a mini survival game. In this game, one fly and three frogs…
Q: Exercise 3: A. Write static methods: • public static double sphereVolume(double r) : r³ • public…
A: Here I have created a class named Geometry. In this class, I have created all 4 methods and then…
Q: debug my program? it's in Java. At line 108, I get the error “The field Person.age is not visible”.…
A: Error found while executing your program: - Explanation: - After executing the given program the…
Q: Write a Java program that reads two positive integers num1 and num2 (assume num1 < num2). Then, the…
A: The question is to write JAVA code for the given problem.
Q: Consider the method headings: void funcOne(int [ ] alpha, int size)…
A:
Q: ?What is the output of the following code // file name: Main.java public class Main public static…
A: Given:
Q: Write a class that has three overloaded static methods for calculating the areas of the following…
A: Please find the answer below
Q: THIS IS MEANT TO BE IN JAVA So far we've learned variables, branches, loops, and some array. The…
A: Here I have taken input from the user and stored it into a variable. Next, I have checked for the…
Q: Write the output of the following program, as it would appear on the console. import java.util.*; //…
A: Your output of the java program is given below as you required.
Q: 3. A program that prints the power table for integers from 1 to 5. The table must include the…
A: public class Main{ public static void main(String[] args) { System.out.print("\t\t\t\t\tPower…
Q: public class FindTheError { public int square(int number) { return number *…
A: Hi. Let's move on to the solutions in next step.
Q: Here is the code given: public class Billing { final static double TAX = 0.08; public static void…
A: Case 1: computeBill() receives a single parameter, it represents the price of one book ordered. Add…
Q: Please use javascript for this code. One lap around a standard high-school running track is exactly…
A: Program: <!DOCTYPE html> <html> <body> <h2>Conversion</h2>…
Q: Write a program that perform the following activities: count number of letters based on the given…
A: class Demo { public static void main(String []args) { String str = "Samuel 605"; int…
Q: Implement the below pseudo-code in a Java program using a while loop and a switch-case statement.…
A: //import the required package import java.util.*; //create a main class called Task public class…
Q: he following program takes two numbers as input from the user when run and is supposed to add those…
A: Consider the given code: public class Example { public static void main(String[] args) { int…
Q: Exercise 2: A. Write static methods: public static double cubeVolume(double h) : h3 public static…
A: public class Geometry { public static double cubeVolume(double h) { return h * h * h;…
Q: Someone please help me . Based on the java code given, how can i improve the error (photo1) and add…
A: Inheritance in Java Definition: Inheritance is a concept that attains the properties from one class…
Q: Write a Java program with a class named Introduction that prints: 1. Your name. 2. A blank line. 3.…
A: Solution : Here i am providing you the program code along with the output. Program Code : public…
Q: Write an java application that allows a user to enter any number of student quiz scores, as…
A: Program: import java.util.*; class Main { public static void main(String args[]) { Scanner sc =…
Q: Write a Java program correctly that generates a report of proof of vaccination against COVID-19 for…
A: We need to write Java program for given specifications.
Q: Write a program Triangle.java that determines the type of triangle from its 3 sides. Your program…
A: NOTE: Code run successfully. Please use proper indentation for no error. I have attached source code…
Q: 1. Write a program in Java that should do the following: a. Prompt the user to enter 3 grades…
A: logic:- multiply any of integer by 1.0 so that average method returns double value . read a, b…
Q: Write a simple Java program to calculate the average daily temperature from the given daily…
A: The below-given java program will obey the following rubrics: Importing necessary header files.…
Q: For this assignment, write a program called Payday.java that will compute and print a person's…
A: Given:
Q: reate a java program that calculates the average test scores. Three employees in a company are ups…
A: Create a java program that calculates the average test scores. Three employees in a company are ups…
Q: 4. Write a Java method that receives an int as input and returns true if the input parameter is 100…
A: Ans 1: The given statement: boolean x = (5 < 8) == (5 == 8); the value of x after the statement…
Q: Write a complete Java program that prints out the following information: 1. Ask the user to enter…
A: GIVEN: Create a Java program that gets the last three digits of the student ID from the user. Then…
Q: Create a java program that calculates the average test scores. Three employees in a company are ups…
A: Java Code: import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import…
Q: What is the output of the following Java code? public class array { public static void main(String…
A: Refer to step 2 for the answer.
Q: Write staticC public static double sphereVolume(double r) :r³ public static double…
A: Here, we have to create 4 static methods to find the volume and surface area of the sphere and cone.…
Q: The question is attached to the image. Please help!
A: Create and initialize the final variable windowWidth and windowheigth. Calculate window area. int…
Q: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: Java program to print the area of a rectangle. The name of the class is Area. This class has two…
Q: For this assignment, write a program called Payday.java that will compute and print a person's…
A: Required: For this assignment, write a program called Payday.java that will compute and print a…
Step by step
Solved in 2 steps
- Control structures: In Java only please. Output the position of the largest number and the largest number in the squence a0, a1, a2....ak. For example, the largest number of the squence is 75, 226, 113, 340, 170, 85, 256, 128, 64, 32, 16, 8, 4, 2, 1 is 340, and it's position is 4. Test your program for the following values of x: 75, 111, 678, 732, 873, 2048, and 65535. Thank youJava Programming Assignment: Sammer, a smart child, just learned about series and numbers. He wrote the numbers in sequence and went to have milk. Unfortunately, while going to the shop he had a small accident and the coins are mixed with the other lady coin (May also mixed negative numbers) Now that you have been given these mixed numbers, your task is to help the little one finds the first missing natural number by using the Java programming language. Sample Input: 1 265-88 6 7 Sample Output: 1in Java Tasks Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows. 1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don't display the computer's choice yet.) 2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. (You can use a menu if you prefer.) 3. The computer's choice is displayed. Tasks 4. A winner is selected according to the following rules: a. If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.) b. If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cuts paper.) C. If one player chooses paper and the other player chooses rock, then paper wins. (Paper wraps…
- Program62.javaWrite a program that prompts for a full name (first and last) and assigns it to one string. The program then passes the full name to a void method as its sole parameter. The void method should print the first name, on one line, as many times as indicated by the length of the last name. Sample Output (image below) Program64.javaWrite a program that demonstrates method overloading by defining and calling methods that return the area of a triangle, a rectangle, or a square.JAVA Given an airplane’s acceleration a and take-off speed v, you can compute the minimum runway length needed for an airplane to take off using the following formula: length = v2 / 2 * a Write a program that prompts the user to enter v in meters/second (m/s) and the acceleration a in meters/second squared ( m/s2 ) , then displays the minimum runway length needed to take off. Here is a sample run: Enter speed and acceleration: 60 3.5 [enter] The minimum runway length for this airplane is 514.286// This program assigns values to two variables // and performs mathematical operations with them public class DebugFour1 { public static void main(String args[]) { int x = 5; int y = 8; int z = 19; System.out.println("adding " + x + y); System.out.println("subtracting " + y - z); System.out.println("dividing " + z / x); System.out.println("multiplying " + x / z); } }
- JAVA CODE ONLY 2. Rectangle by CodeChum Admin A rectangle can be formed given two points, the top left point and the bottom right point. Assuming that the top left corner of the console is point (0,0), the bottom right corner of the console is point (MAX, MAX) and given two points (all "x" and "y" coordinates are positive), you should be able to draw the rectangle in the correct location, determine if it is a square or a rectangle, and compute for its area, perimeter and center point. To be able to do this, you should create a class for a point (that has an x-coordinate and a y-coordinate). Also, create another class called Rectangle. The Rectangle should have 2 points, the top left and the bottom right. You should also implement the following methods for the Rectangle: display() - draws the rectangle on the console based on the sample area() - computes and returns the area of a given rectangle perimeter() - computes and returns the perimeter of a given rectangle…Calculate your Physics final Write a Java program to solve the following problem: grade based on the following: Assessment Percent Lab Activity(ies) Quiz (zes)/Test (s) 10% 10 Assignment (s) 208 Midterm Exam (8) 20% Final Exam 40% Theory grade is the quiz/test, midterm and final exam marks. Practical grade is the assignment and lab marks. Final grade is all five marks. But the calculation of Final grade needs to comply with the following rule: If either of the practical or theory grade is less than 50%, the final grade is the lesser of the two. A grade letter must be assigned based on the final grade (See the courses outline for the distribution of grades) You must implement input validation for each mark as follows: Lab mark must be out of 10. Quiz/Test mark must be out of 10. Assignment mark must be out of 20. Midterm mark must be out of 20. Final Exam must be out of 40. Bonus: Modify your code so that you can calculate and display grade for N number of students. Your program must…Write a program in Java Write a program that has variables to hold three test scores. The program should ask theuser to enter three test scores and then assign the values entered to the variables. The programshould display the average of the test scores and the letter grade that is assigned forthe test score average. Use the grading scheme in the following table:
- Understanding ifStatements Summary In this lab, you complete a prewritten Java program for a carpenter who creates personalized house signs. The program is supposed to compute the price of any sign a customer orders, based on the following facts: The charge for all signs is a minimum of $35.00. The first five letters or numbers are included in the minimum charge; there is a $4 charge for each additional character. If the sign is made of oak, add $20.00. No charge is added for pine. Black or white characters are included in the minimum charge; there is an additional $15 charge for gold-leaf lettering. Instructions 1. Ensure the file named HouseSign.java is open. 2. You need to declare variables for the following, and initialize them where specified: A variable for the cost of the sign initialized to 0.00 (charge). A variable for the number of characters initialized to 8 (numChars). A variable for the color of the characters initialized to "gold" (color). A variable for the…basic java please Write a void method named emptyBox()that accepts two parameters: the first parameter should be the height of a box to be drawn, and the second parameter will be the width. The method should then draw an empty box of the correct size. For example, the call emptyBox(8, 5) should produce the following output: ***** * * * * * * * * * * * * ***** The width of the box is 5. The middle lines have 3 spaces in the middle. The height of the box is 8. The middle columns have 6 spacesin Java, Write a program that reads student scores, gets the best score, and then assigns grades based on the following scheme:• Grade is A if score is ≥ best − 10• Grade is B if score is ≥ best − 20;• Grade is C if score is ≥ best − 30;• Grade is D if score is ≥ best − 40;• Grade is F otherwise.The program prompts the user to enter the total number of students, then prompts the user to enter all of the scores, and concludes by displaying the grades. Here is a sample run: number of students: 4 scores are: 40.0, 55.0, 70.0, 58.0 Student 0 score is 40.0 and grade is C Student 1 score is 55.0 and grade is B Student 2 score is 70.0 and grade is A Student 3 score is 58.0 and grade is B