Maria's grade is 82.8 because her average of (72 + 91 + 84 + 89 +78)/5 equals 82.8. Write a method called longestName that accepts a Scanner for the console and an integer n as parameters and prompts for n names, then prints the longest name (the name that contains the most characters) in the format shown below, which might result from a call of longestName (console, 4): name #1? Roy name #2? DANE name #3? STEFANIE name #4? Mariana Stefanie's name is longest
Q: Write a method called anglePairs that accepts three angles (integers), measured in degrees, as…
A: Given: Write a method called anglePairs that accepts three angles (integers), measured in degrees,…
Q: Write a method called perfectNumbers that accepts an integermaximum as its parameter and prints all…
A: Program: Programs are used to solve complex problems. The main objective of the program is…
Q: Write a method called updateTally, which calls nthDigit. updateTally takes in three arguments, an…
A: To do: Code for the given
Q: a method called printPowersOfN that accepts a base and a maximum exponent as arguments. The method…
A: It is defined as command line argument, can be stated as input given to a command line to process…
Q: Write a method called min that takes three integers as parameters and returns the smallest of the…
A: Given: Write a method called min that takes three integers as parameters and returns the smallest of…
Q: Write a Java program that implements static method roundSum() so that given 3 ints: a, b, and c;…
A: Given: Write a Java program that implements static method roundSum() so that given 3 ints: a, b, and…
Q: Write a method called writeNums that takes an integer n as a parameter and prints to the console the…
A: If number is less than 1 then The exception has to be thrown If Exception is thrown, the…
Q: Write a method in Java called processName that accepts a Scanner for the console as a parameter and…
A: JAVA CODE: //import the Scanner class...import java.util.Scanner; public class Main{ //define the…
Q: Write a method that accepts two integer parameters rows and cols. The output is a comma-separated…
A: public static void printGrid(int iRows, int iCols) { StringBuilder sb = new…
Q: Consider the following two static methods, where f2 is intended to be the iterative version of f1.…
A: Given methods :- public static int f1(int n){ if (n < 0) { return 0; }…
Q: For what value of the parameter į would the return of this method be 8 given that value of j =1? If…
A: For i = 2 and j = 1, the return of the given method will be 8.
Q: Write a method named printTemperature of type void to display a table of the Celsius temperatures 0…
A: Here, I provided C code solution to the above question.
Q: Define a method computeGasVolume that returns the volume of a gas given parameters pressure,…
A: Here is program code : // Header files section#include <stdio.h> // constan declarationconst…
Q: Write a program that prompts for a full name (first and last) and assigns it to one string. The…
A: As per our company guidelines we are not supposed to answer more than one question per post and…
Q: Write a static method called max3 that accepts three parameters (all integers) and returns the…
A: static methods can be directly called without creating any instance and here, we have provided you…
Q: Write a method called friendlyNumbers that accepts two 4-digit integer parameters n1 and n2. The…
A: Code public class Main{ public static void main(String[] args) { friendlyNumbers(3451,3981); }…
Q: Given an anonymous word W and a text M. You are required to write a method which takes W and M as…
A: Algorithm: Start Read word W and text M Define a method anonymous_word() which takes W,M as…
Q: Write a method called method4 that accepts an integer parameter n and returns a sum of the first n…
A: import java.util.Scanner; public class Tester{ public static void main(String[] args) { Scanner…
Q: Write a method in Java named printGPA that calculates a student's grade point average. The user will…
A: Let's solve the given problem using printGPA method in Java programming language. Input: import…
Q: Write a method named printTemperature of type void to display a table of the Celsius temperatures O…
A: C code #include <stdio.h> void printTemperature(int cel[],int size) { double far[size];…
Q: Write a static method named allDigitsIncreasing that accepts an integer n as a parameter and returns…
A: Static method allDigitincreasing given below
Q: Write a method named method1 that accepts two parameters: a String name and a separator (character).…
A: Given:
Q: Write a method named digitsum that accepts an integer as a parameter and returns the sum of the…
A:
Q: Write a Java method named check() that checks the validity of a password received as string…
A: import java.util.Scanner; public class Exercise11 { public static final int PASSWORD_LENGTH = 8;…
Q: Assume that we want to swap the values of two integer -variables, a andb. To do this, we write a…
A: Here the method swap accepts the value of i1 and i2 passed through the function call in main…
Q: Write the static method dayOfWeek, which returns the integer value representing the day of the week…
A: Actually, program is an executable software that runs on a computer.
Q: Write a method in Java called printPowersOfN that accepts a base and an exponent as arguments and…
A: public class Main{ public static void printPowersOfN(int base, int exponent) { for(int…
Q: Write a method that returns the sum of a range of numbers. It should take the starting and ending…
A: The above question is solved in step 2 :-
Q: Write a static method avgNo Tens() that will receive two ints A and B and return the average of all…
A: The program for the above given question is given below:
Q: Write a program that will prompt the user to enter a sentence (string data), read that entire…
A: Given something from the client, the program will make a 3D shape out of it where the word will be…
Q: • You are maintaining a software and you come across the following method. Comment on its quality by…
A: The first thing that is a issue here is the method not having correct indentations. Correct…
Q: Second, write a method named gameStatus in TicTacToe. This method will take no input and will return…
A:
Q: Write a program called Deleted_position.java that has a method with one int array as a parameter,…
A: I give the code in Java along with output and code screenshot
Q: Write a Java method named check() that checks the validity of a password received as string…
A: Algorithm : check function : Step 1 : declare variables. Step 2 : initialize variables. Step 3 :…
Q: Write a method on elicpse, computeFutureValue, which receives the investment amount, annual interest…
A: Here, Code instruction is given.
Q: what is the java code for the class and Write one or more tests that check that the method works as…
A: Code: import java.util.*; //Class Fibonacci Counter class FibonacciCounter { int n; //A…
Q: Write a static method named countMoney that accepts as its parameter a Scanner for an input file…
A: public static void countMoney(Scanner sc) { int tot = 0; while(sc.hasNext()) { int quantity =…
Q: 1. Takes command line arguments (strings) and determines which string is the longest. 2. If there…
A: Check for the lengths of each string and compare them using if else conditions
Q: Write a program that has a loop of three iterations. In every iteration, the program should prompt…
A: ## AS no language mentioned, we write the code in Python language. # user define function to…
Q: ava write a method (void rect(int a,int b)), which draws the following figure: a rectangle size a x…
A: Nested for loop: For loop inside a for loop is called nested for loop. The nested for loop has two…
Q: od in Java named daysInMonth that accepts a month (an integer between 1 and 12) as a parameter and…
A: SUMMARYRoad to Java : Often, a method is a way of doing a particular job. Similarly, a path in Java…
Q: Consider the method below: public void myMethod() { 01 02 03 int x = 3; 84 printin(x + y); int z =…
A: The lines where it is valid to access the value of y:
Q: 2. Write a method to display the following on the screen without using any System.out.println, just…
A: // Defining the Main Classpublic class Main{ // Main method public static void main(String[]…
Q: Write a method triangleArea() which a receives as input two integers representing the base length…
A: NOTE:- As the language is not mentioned. So, the program is done using C language. CODE:- #include…
Q: In Public Class, create a static void method called Info_AHW that takes 3 parameters - an int and…
A: Here I have created a function named Info_AHW(). In this function, I have created a print statement…
Step by step
Solved in 2 steps
- The number of permutations of a set of n items taken r at a time is given by the followingformulan!/r!(n−r)!: where n! is the factorial of n, r! is the factorial of r, and (n-r)! is thefactorial of the result of n-r. The factorial of a number n can be solved using the followingformula: n!=e−nnn√ 2πn.If there are 18 people in your class and you want to divide the class into programming teams of 3members, you can compute the number of different teams that can be arranged using this formula(n!/r!(n−r)!).Write a C++ program that determines the number of potential team arrangements. You will needto use the double type for this computation. Use the Lab Template you set-up last week, properformatting, and appropriate comments in your code. The output must be labeled clearly andformatted neatly.Question # 2Assume the followingString s,t,h,a,n,e;int i;h = “Hello”;s = “How are you?”a = “abc”;n = null;e = “”;Give the values of the following expressions, or illegal1. h.length()2. h.substring(1)3. h.toUpperCase()4. h.toUpperCase().toLowerCase()5. h.indexOf("H")6. h.startsWith("ell")7. "Tomorrow".indexOf("o")8. "Tomorrow".indexOf("o", 3)9. "Tomorrow".lastIndexOf('o')10. "a = \"" + a + "\""11. (a.length() + a).startsWith("a")12. a.length() + a.startsWith("a")13. ">>>" + a.length() + a.startsWith("a")14. a.substring(1,3).equals("bc")15. a.substring(1,3) == "bc"16. "a".compareTo("c")17.…What is the probability that in a classroom of x people, at least 2 will be born on the same day of the year, ignoring leap year? The number of people (x) in the simulated class is given by the user. Please use the code outline that I was given: import mathimport random # create and initialize frequency table:ft = []k = 0while(k < 365) : ft.append(0) k = k+1 # Allow the user to determine class size:print("Please type in how many people are in the class: ")x= int(input()) success = 0 # Simulate:c = 0while(c < 10000) : # Step 1: re-initialize birthday frequency table (it must be re-initialized for each play-through (why?): k = 0 while(k < 365) : ft[k] = 0 k = k+1 # Step 2: randomly get x birthdays and update frequency table: k = 0 while(k < x): # your code goes here ########################## k = k+1 # Step 3: Check to see if this class has at least two people with same b-day and update success appropriately k = 0 while(k < 365):…
- Write it's main. char space[3][100] = { "#.*.#******#****.****#.*.", "#***#******#*.**.*.*.#***", "#*.*#******#*********#*.*" }; int space_ind; for(space_ind = 0; space[0][space_ind];space_ind++) { if(space[0][space_ind] == '#') printf("#"); elseif (space[2][space_ind] == '.' ) continue; elseif(space[0][space_ind] == '.') printf("A"); elseif(space[1][space_ind] == '.') printf("I"); elseif(space[0][space_ind+1] == '.') printf("U"); elseif(space[1][space_ind+1] == '.') printf("O"); elseprintf("E"); if(space[0][space_ind] == '#' || space[2][space_ind] == '.' ) continue; else space_ind+=2; } return0;.Constellation. Write it's main. char space[3][100] = { "#.*.#******#****.****#.*.", "#***#******#*.**.*.*.#***", "#*.*#******#*********#*.*" }; int space_ind; for(space_ind = 0; space[0][space_ind];space_ind++) { if(space[0][space_ind] == '#') printf("#"); elseif (space[2][space_ind] == '.' ) continue; elseif(space[0][space_ind] == '.') printf("A"); elseif(space[1][space_ind] == '.') printf("I"); elseif(space[0][space_ind+1] == '.') printf("U"); elseif(space[1][space_ind+1] == '.') printf("O"); elseprintf("E"); if(space[0][space_ind] == '#' || space[2][space_ind] == '.' ) continue; else space_ind+=2; } return0;.Assume the followingString s,t,h,a,n,e;int i;h = “Hello”;s = “How are you?”a = “abc”;n = null;e = “”;Give the values of the following expressions, or illegal1. h.length()2. h.substring(1)3. h.toUpperCase()4. h.toUpperCase().toLowerCase()5. h.indexOf("H")6. h.startsWith("ell")7. "Tomorrow".indexOf("o")8. "Tomorrow".indexOf("o", 3)9. "Tomorrow".lastIndexOf('o')10. "a = \"" + a + "\""11. (a.length() + a).startsWith("a")12. a.length() + a.startsWith("a")13. ">>>" + a.length() + a.startsWith("a")14. a.substring(1,3).equals("bc")15. a.substring(1,3) == "bc"16. "a".compareTo("c")17.…
- 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…Please fix the code below to make it faster def countInBox(particleData, steps, lx, ly, ux, uy):for _ in range(steps):for i in range(len(particleData)):nx, ny= particleData[i][2]/particleData[i][3], particleData[i][4]/particleData[i][5]x, y = particleData[i][0], particleData[i][1]particleData[i][0] = nx * x - ny * yparticleData[i][1] = ny * x + nx * yreturn sum([1 for i in range(len(particleData)) if(lx < particleData[i][0] < ux and ly < particleData[i][1] < uy)])bob employs a painting company that wants to use your services to help create an invoice generating system. the painters submit an invoice weekly. they charges $30 per hour worked. they also charge tax -15%. bob likes to see an invoice that display all the information- number of hours, the charge per hours, the total Before tax and total After tax. since this is an invoice, we also need to display the name of the company (painting Xperts) at the top of the invoice. display all of the information on the screen. Using Pseudocode, develop an algorithm for this problem.
- The number of permutations of a set of n items taken r at a time is given by the following formulan!/r!(n−r)!: where n! is the factorial of n, r! is the factorial of r, and (n-r)! is the factorial of the result of n-r. The factorial of a number n can be solved using the following formula: n !=e−n nn √ 2 πn. If there are 18 people in your class and you want to divide the class into programming teams of 3 members, you can compute the number of different teams that can be arranged using this formula (n!/r!(n−r)!). When writing a C++ program that determines the number of potential team arrangements. You will need to use the double type for this computation.Complete the function below that takes in three integers (a,b,c) and returns the number of integers between a and b (inclusive of the endpoints) that are divisible by c. Make sure it tests a and b for divisibility by c! In [ ]: defhow_many_divisible(a,b,c):counter=0# YOUR CODE HEREraiseNotImplementedError()returncounter In [ ]: assert how_many_divisible(10,20,5) == 3 assert how_many_divisible(30,77,7) == 7 PYTHON jYPYTERJava - Programming Develop a letter-guessing game in this assignment.Requirements:1). When the game begins, generate a random letter between A and Z;2). Display a message "I have a secret letter (A to Z), can you guess what it is?";3). Read the user's answer;4). Compare the user's answer and the random secret letter generated;5). If the user answer is before the random secret letter in the alphabet, display "Incorrect. Trysomething later in the alphabet" and go to Step 2;6). If the user answer is after the random secret letter in the alphabet, display "Incorrect. Trysomething earlier in the alphabet." and go to Step 2;7). If the user answer is the same as the random secret letter, display "Well done. Want to playagain (y/n)?";8). Read the user's answer. If the answer is 'y', go to Step 1. If the answer is 'n', go to Step 9;9). Display "Thanks for playing the game. Goodbye!". The program stops.Run your program several times. Take screenshots. Submit your Java file with the screenshots