Question 1) Write a method that takes continuously a positive number from the user and then returns the square of this number. The program continues to run until the entered number is zero. This method should have the following signature: public static double square(double x) Sample run: Enter a positive number: 3 The squared value of 3 is 9 Enter a positive number: 5.5 The squared value of 5.5 is 30.25 Enter a positive number: 0
Q: The program with the main method should be called ‘LetterCode.java’ The program with the class for…
A: public class LetterCodeLogic { public static String ENCODE(String m) { String…
Q: public static boolean isPrime(int number) public static void printPrime(int x) - printPrime method…
A: Sample Output: 2 3 5 7 11 13 17 19 23 29 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73…
Q: A method may accept any number of values, including zero O True O False
A: True
Q: Exercise 1 Create a method that takes a value and indicate whether it is positive or negative by a…
A: As per guidelines if multiple question posted we can answer only first 3 questions, please re-post…
Q: Celsius Temperature Table - prog 6 pg 291 * formula for fahrenheit to celsius is c = 5/9(f-32) *…
A: I give the code in java along with output and code screenshot
Q: Question 2 has bigger options otherwise according to your policy they are 3 questions at a time.…
A: Ans 1: The signature of a method consists of: 1) method name Ans 2: Fille the code given: public…
Q: (Intro to Java) Avoid using breaks in loops or statments. Ice Cream Truck In this program, you…
A: import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner…
Q: Financial Application:• Write a program that computes future investment value at a given interest…
A: Program plan:Import necessary packages.Define a class named “Investment”.Define a method named…
Q: Declare a method with three arguments all of the type int. The method should return the greatest of…
A: The program is written in java. Please find the program in below step.
Q: 5) Write a method which gets a value from the user and convert that value from Celsius to…
A: Please find the answer below
Q: Write a method for solving a quadratic equationusing the following header:public static int…
A: EXPLANATION: - Quadratic Equation is given as: - ax^2 + bx +c = 0 The input for a,b, and c is…
Q: Toll roads have different fees based on the time of day and on weekends. Write a method calcToll()…
A: First we will convert both the time intervals given (i.e. Weekdays and Weekends) into minutes only.…
Q: Retail price calculator Write a program that asks the user to enter an item’s wholesale cost and its…
A: Step 1 : Start Step 2 : Define a method calculateRetail() to calculate and return the retail price…
Q: 2.5 Implement the main method that will ask the user to provide 2 integers as input. After taking…
A: C++ code as par your requirements: #include <bits/stdc++.h> using namespace std; void…
Q: 2. Write a method that calculates the tax on a price. The price and tax percentage should be…
A: Hello student Greetings Hope you are doing great. As per our policy guidelines, in case of multiple…
Q: 3) Create a method which generates and prints "n" random numbers. The method takes an int parameter…
A: Programming language is not mentioned so we are going to solve the problem in python language.
Q: Input a number value for LEFT, RIGHT and X. If LEFT is greater than RIGHT, display the first ten…
A: Find the required code in java given as below and output :
Q: 15) What does the following method do? public int question15( ) { int value1 = 0; int value2 = 0;…
A: Given that, What does the following method do?public int question15( ) {int value1 = 0;int value2 =…
Q: Predict the return type of the below method. public static _______ calculate(int a , double b) {…
A: The options “int”, “float”, and “boolean”, are not the correct answers as the given method doesn’t…
Q: One lap around a standard high-school running track is exactly 0.25 miles. Write a program that…
A: Required: One lap around a standard high-school running track is exactly 0.25 miles. Write a…
Q: C# Question Write a statement that declares a variable called even and assigns it to the value…
A: Given: C# Question Write a statement that declares a variable called even and assigns it to the…
Q: (Number of days in a year) Write a method that returns the number of days in a year using the…
A: public class Solution { public static boolean isLeayYear(int y) { // if leap year…
Q: 5. Falling Distance When an object is falling because of gravity, the following formula can be used…
A: PROGRAM CODE: import java.util.Scanner; // import utility packagepublic class Main…
Q: 1.Using pseudocode, a method that will add two numbers, and return the sum to the calling function.…
A: The, code has given below:
Q: Write a method, countEvens(), that has four integer parameters, and returns the count of parameters…
A: A number is said to be even if number leaves remainder 0 on dividing with 2 The remainder on…
Q: Create a program “MethodTests" which will contain a number of methods all called from the main…
A: Java Program for Above : import java.util.Scanner; class MethodTests{ //Method 1: public…
Q: Create a program "Method Tests" which will contain a number of methods all called from the main…
A: Problem: Create a method1 takes 1 string parameter print the string Create method2 takes 1…
Q: 5) Write a method which gets a value from the user and convert that value from Celsius to…
A: Please find the answer below :
Q: Part I Write a method that rotates the triangle around the origin with given degree. Note: Be…
A: Java Program: import java.lang.Math;import java.util.Scanner;// Point classclass Point{ // data…
Q: 1. Write a program that takes three numbers (a,b,c) from the user as input and finds the median of…
A: Answer in step2
Q: A void method may contain a return statement in which form (assume x is int)? return x return 10;…
A: There a re various return type of a method. Void is one of them, if a method is declared void it can…
Q: emptyBox()that accepts two parameters: the first parameter should be the height of a box to be…
A: Here the method should first accept the values from main function. The code or statement to draw…
Q: Write a program (use value returning method) that prompts you to enter five scores. The program…
A: Given: Write a program (use value returning method) that prompts you to enter five scores. The…
Q: a- Write a method called even ToZero that takes as parameter an integer limit'. The method prints on…
A: Java code: import java.util.Scanner;public class Test { //function to print even number from…
Q: Write a method called CaculateTuitionFee(int numberOfCourses, double costPerCourse = 449.99). This…
A: Coded using C#.
Q: You can use the following logic to determine whether a number is even or odd: if ((number % 2) == 0)…
A: Answer in step2
Q: Problem: Min Method (Return the Smaller Number) Create a method GetMin(int a, int b), which returns…
A: Answer :-
Q: 3. write a method which calculate the Earns as following: If the Job is Teaching assistance : Earns…
A: Required: C# program to calculate earning and print the results. All code and screenshots have…
Q: Write a method that calculates the tax on a price. The price and tax percentage should be doubles.…
A: the answer to the following question:-
Q: Financial Application:• Write a program that computes future investment value at a given interest…
A: Program plan:Import necessary packages.Define a class named “Main”.Define a method named…
Q: You can declare a void method as follow; public void int calculateSalary() { int num1=89; int…
A: WE have to find weather the syntax is correct or not.
Q: 8 - question Given the following method; public void mysteryXY (int x, int y) { if (y == 1) {…
A:
Q: Trigonometric method draw circle full code program ask User (Xc,Yc,radius r) in main class
A: Trigonometric method draw circle full code program ask User (Xc,Yc,radius r) in main class Since…
Q: What does the following method do? public int question15( ) { int value1 = 0; int value2 = 0;…
A: 3.It returns the index of the child who sold the most candy bars
Q: The area of a pentagon can be computed usingthe following formula: Write a method that returns the…
A: Objective: The program determines the area of a pentagon using the formula, area =…
Q: 1. Complete the following methods: a) public static double calculateArea (double radius) { // return…
A: a) public static double calculateArea (double radius){ double area; area= 3.14*radius*radius; return…
Q: The area of a rectangle can be computed using the following formula:…
A: The program is written in Java. Check the program screenshot for the correct indentation. Please…
Q: QUESTION 2 A prime number is a number that is evenly divisible only by itself and 1. For example,…
A: A prime number is a number that is evenly divisible only by itself and 1. For example, the number 5…
Step by step
Solved in 2 steps with 1 images
- This program inputs the names of 5 students and the (integer) grades they earned in 3 tests. It then outputs the average grade for each student. It also outputs the highest grade earned in each test and the average of all grades in each test. Your output should look like this: Mary's average grade was 78.8% Harry's average grade was 67.7% etc... : : In test 1 the highest grade was 93% and the average was 89.2% In test 2........etc Your main method should be modular. Write a method that inputs the 5 names into an array (one dimensional), and returns this array to the main Write a method that inputs the 15 (integer) test grades into a (two-dimensional) array, and returns this array to the main Write a method that calculates the students averages and stores them in an array, and returns this array to the main Write a method that calculates the average grade for each test and stores them in an array, and returns this array to the main Write a method that determines the highest grade…Financial Application:• Write a program that computes future investment value at a given interest rate for aspecified number of months and prints the report shown in the sample output. • Given the annual interest rate, the interest amount earned each month is computedusing the formula: Interest earned = investment amount * annual interest rate /1200 (=months * 100) • Write a method, computeFutureValue, which receives the investment amount, annualinterest rate and number of months as parameters and does the following: o Prints the interest amount earned each month and the new value of theinvestment (hint: use a loop). o Returns the total interest amount earned after the number of months specified bythe user. The main method will:o Ask the user for all input needed to call the computeFutureValue method.o Call computeFutureValueo Print the total interest amount earned by the investment at the end of thenumber of months entered by the user. Sample Program runningEnter the investment…Question P Print person1's kids, call the incNumKids() method, and print again, outputting text as below. End each line with a newline. Sample output for below program with input 3: Kids: 3 New baby, kids now: 4 // ===== Code from file PersonInfo.java =====public class PersonInfo {private int numKids; public void setNumKids(int setPersonsKids) {numKids = setPersonsKids;} public void incNumKids() {numKids = numKids + 1;} public int getNumKids() {return numKids;}}// ===== end ===== // ===== Code from file CallPersonInfo.java =====import java.util.Scanner; public class CallPersonInfo {public static void main(String [] args) {Scanner scnr = new Scanner(System.in);PersonInfo person1 = new PersonInfo();int personsKid; personsKid = scnr.nextInt(); person1.setNumKids(personsKid); /* Your solution goes here */ }}// ===== end ===== Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this…
- The statement used to invoke the following method is public static int max(int num1, int num2) { int result = num1+ num2; return result; } ans max(3, 5); max(5); max("num1" , "num2");Write a method that returns the lcm (least common multiple) of an unspecified number of integers. The method header is specified as follows: public static int lcm(int... numbers) Write a test program that prompts the user to enter five numbers, invokes the method to find the lcm of these numbers, and displays the lcm.write a program that reads the followinginformation and prints a payroll statement.Employee’s name (e.g., Smith)Number of hours worked in a week (e.g., 10)Hourly pay rate (e.g., 9.75)Federal tax withholding rate (e.g., 20%)State tax withholding rate (e.g., 9%) In summary, design a program to• Prompt user for 5 values and read the values using Scannero Use method .nextLine() to get the String for the nameo Use method .nextDouble() to get all other numeric values• Calculating the Gross payo Gross pay = hours worked * hourly pay rate• Calculating the Federal withholdingo Federal withholding = Gross pay * federal tax withholding rate• Calculating the State withholdingo State withholding = Gross pay * state tax withholding rate• Calculating the Total deductiono Total deduction = Federal withholding + State withholding• Calculating the Net Payo Net Pay = Gross pay – Total deduction• Formatting the output same as the Sample run (Use ONLY printf)o Correctly format 2 decimals and use $ (hint…
- Write a method thatcomputes future investment value at a given interest rate for a specified numberof years. Use the following method header:public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate,int years)For example, futureInvestmentValue(10000, 0.05/12, 5) returns12833.59.Write a test program that prompts the user to enter the investment amount (e.g.,1,000) and the interest rate (e.g., 9%) and prints a table that displays future valuefor the years from 1 to 30, as shown below: The amount invested: 1000Annual interest rate: 9Years Future Value1 1093.802 1196.41...29 13467.2530 14730.57Write a method that returns a random number from alist of numbers passed in the argument. The method header is specified as follows:public static int getRandom(int... numbers)Please provide the screenshots of the Java program and the Screenshot of the output. You can use the following logic to determine whether a number is even or odd:if ((number % 2) == 0) { // The number is even. }else { // The number is odd. } Write a program with a method named isEven that accepts an int argument. The method should return true if the argument is even, or false otherwise. The program’s main method should use a loop to generate 100 random integers. It should use the isEven method to determine whether each random number is even, or odd. When the loop is finished, the program should display the number of even numbers that were generated, and the number of odd numbers.
- 1. Write a program that will ask the a user a number between 1 to 7. 2. Print out the equivalent day of the week for that number. Starting 1 for Sunday, 2 for Monday and etc. 3. Use at least 1 user-defined method aside from your main method in writing a code for this problem (Input number: Expected Output: )Program61.javaWrite a program that prompts an employee to enter his/her hourly pay rate and hours worked last week. Call a method that takes these inputs as arguments. This method should calculate and print the employee's regular pay and overtime pay in currency format. The method should return the gross pay to main. The main method should print the gross pay in currency format.Sample Output (image below) 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)This is java problem: Write a program that simulates tossing a coin. Prompt the user for how many times to toss the coin. Code a method with no parameters that randomly returns either the String "heads"or the string "tails". Call this method in main as many times as requested and report the results. See Example outputs below. Example Outputs How many times should I toss the coin? 1000 Results of 1000 tosses. Heads: 483, tails: 517 How many times should I toss the coin? 1000000 Results of 1000000 tosses. Heads: 500074, tails: 499926 Required Textbook: Introduction to Java Programming and Data Structures, Comprehensive Version, Edition: 11th Author: Y. Daniel Liang Publisher: Pearson ISBN: 9780134670942